I am using TCPClient.write() to send data to the server. I am posting a stuff to the server in JSON format. The write() function returns 176 bytes written and the size of the data I sent was also 176 bytes. But I do not see anything on the server. If write() returns a valid number of bytes doesn’t it mean there was a successful write on the server? Here is the code snippet.

char dataToSend[200];
sprintf(dataToSend, "POST /location/%s HTTP/1.1\r\nHost:%s\r\nContent-Type:application/json\r\nContent-Length:%d\r\n\n%s\r\n0x1A", "865067021570786", "", 61, "\"lat\":53.645438, \"log\":10.164412, \"timestamp\":1471284581534");

             if (!client.connected()) {
                 client.connect(myServer, 8020);

             if (client.connected()) {
                 int size = strlen(dataToSend);
                 int written = client.write((unsigned char *)dataToSend, size);
                Serial.printlnf("DataSize: %d, Bytes written: %d", size, bytes);

I get this output:
DataSize: 176, Bytes written: 176

I’m not sure if terminating the request with "0x1A" will do the job.
I thought a valid HTTP request should end with "\r\n"

BTW, that sprintf() statement which inserts complex string literals into a string like that looks confusing :confused:
I guess this will not be a production code and is just for demonstration.