This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Get Request

Hi, Everyone.

I'm new to the CC3000 and programming for networks. I've written a function to send a get request but every time I try to get a socket handle I get -126 returned. Am I doing something wrong? What does -126 mean? My code is below:

void getWebpage(char host[50],char page[50])
{
int Sockethandle, Sockethandle2;
int success;
unsigned long ipsuccess;
unsigned long ipaddress;
char getrequest[150];
struct _sockaddr_in_t serveraddr;
int port = 80;
//Setup TCP Server
Sockethandle = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
//check to see if socket function succesful
if (Sockethandle >-1){
//get ip address of host
ipsuccess = gethostbyname(host, sizeof(host),&ipaddress);
if(ipsuccess>0){
//populate serveraddr structure
serveraddr.sin_family = AF_INET;
serveraddr.sin_port = htons(port);
serveraddr.sin_addr.s_addr = ipaddress;
//connect to server
success= connect(Sockethandle, (const sockaddr *) &serveraddr, sizeof(serveraddr));
//create get request
sprintf(getrequest, "Get %s HTTP/1.1\r\nHost: %s\r\n\r\n\r\n", page, host);
//send get request
success = send(Sockethandle, getrequest, strlen(getrequest), 0);
//recieve reply
recv(Sockethandle,  &webpagereturn , sizeof(webpagereturn), 0);
}}}
Many thanks.