Added testing code for retrieving HTTP response
This commit is contained in:
		
							
								
								
									
										11
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								main.c
									
									
									
									
									
								
							@@ -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.
 | 
			
		||||
	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;
 | 
			
		||||
	int remote_socket = create_remote(-1,'T',url_to_hostname(url),port,address_struct);
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	XmHTMLTextSetString(result_widget,"");
 | 
			
		||||
	send(remote_socket,request,strlen(request),0);
 | 
			
		||||
	
 | 
			
		||||
	recv(remote_socket,response,sizeof(response),0);		
 | 
			
		||||
 | 
			
		||||
	XmHTMLTextSetString(result_widget,response);
 | 
			
		||||
//	printf("%d\n",val);
 | 
			
		||||
//	exit(2);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user