Added testing code for retrieving HTTP response

master
Aadhavan Srinivasan 2 years ago
parent f8b64d9afa
commit 5b61ab14c0

@ -79,12 +79,17 @@ void testFunc(Widget w, XtPointer client_data, XmPushButtonCallbackStruct *callb
and make the connection for us. It returns the socket, so that the HTTP request can be made. and make the connection for us. It returns the socket, so that the HTTP request can be made.
First parameter is IP version - set to -1 because we don't know yet if the address is IPv4 or IPv6. */ First parameter is IP version - set to -1 because we don't know yet if the address is IPv4 or IPv6. */
char* request = "GET /~fdc/sample.html HTTP/1.1\nHost: www.columbia.edu\n\n"
char* response = malloc(sizeof(char) * 5000);
struct sockaddr* address_struct; struct sockaddr* address_struct;
int remote_socket = create_remote(-1,'T',url_to_hostname(url),port,address_struct); int remote_socket = create_remote(-1,'T',url_to_hostname(url),port,address_struct);
send(remote_socket,request,strlen(request),0);
recv(remote_socket,response,sizeof(response),0);
XmHTMLTextSetString(result_widget,""); XmHTMLTextSetString(result_widget,response);
// printf("%d\n",val); // printf("%d\n",val);
// exit(2); // exit(2);
} }

Loading…
Cancel
Save