I connected to the server with the following code
web_socket = socket(AF_INET, SOCK_STREAM, 0);
memset(&server_address, 0, sizeof(struct sockaddr_in));
inet_pton(AF_inet, "166.111.1.1", &server_address.sin_addr);
server_address.sin_family = AF_INET;
server_address.sin_port = htons(8080);
indicator = connect(web_socket, (struct sockaddr *) &server_address, sizeof(server_address));
The execution of the above code results in indicator being 0, which means connection to the server is successful, but when I tried to write
string request = "GET http://166.111.1.1:8080/sensor?value=10.3";
indicator = write(web_socket, request.c_str(), request.length());
I cannot see anything under
http://166.111.1.1:8080/sensor?value=10.3
or
http://166.111.1.1:8080/sensor
though the indicator equals to the request length.
Is there anything wrong with the code above? I am testing on Ubuntu 12.04 using QT Creator, GCC