Client works on a LAN but don't send all the data
Hello, I have been having problems with my client because isn't able to send all the data (or that's what I think). The scenario is the next:
- 2 pc on the same LAN (both windows XP)
- 1 server (my own server, not a professional server :)) on the pc #1. That server can get a param from the header (like HTTP params) 'ECHO<crlf>' that internally means 'Return the same message you receive': if the recv header have a 'Content-Length: 0<crlf>' then sends a 'Hello from server'; else sends the content message.
- 1 client (also my own client, less professional than the server) on pc #1. That client sends an HTTP header like
Code:
POST / HTTP/1.0<crlf>
Connection: Close<crlf>
User-Agent: DemoClient/1.0<crlf>
Host:123.456.789.0<crlf>
Accept: */*<crlf>
ECHO<crlf>
Content-Length: 4<crlf>
<crlf>
test<crlf>
Ok, I run the server on pc#1 and the client on pc#1, the client send all the data, the server recv it all and resend 'test'. It works well.
After that, from pc #2 I run the internet browser, connect to my server index page, download the client program from pc#1 (so may I think that the server doesn't have any problem, or any important problem, because I can browse through the server's index page, several links, several formats and there's no problem). Right, now I have the client on pc#2, I run it, send all the data but on the server only arrive since the '<crlf><crlf>', the message 'test' remains I-don't-know-where, the server returns nothing, and whil terminating the conexion I get some unexpected last bytes, exactly 4 bytes, and if I printf them are the message content sended by the client.
Why does it happens when working from different pc but not when I'm work on the same? The server should work well because I can recv the data from forms of webpages settedup with method POST.
The header request from browsers MSIE and NSN when they submit a form in method POST, haven't notably differences with the header on my client. That are a sample of the header that a MSIE browser sends to my server to submit a form in POST method:
Code:
POST /DIRSERVER/response.txt HTTP/1.1<crlf>
Accept: image/gif, (more types)<crlf>
Referer: http://123.456.789.0/<crlf>
Accept-Language: es<crlf>
Content-Type: application/x-www-form-urlencoded<crlf>
Accept-Encoding: gzip, deflate<crlf>
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5...)<crlf>
Host: 123.456.789.0<crlf>
Content-Length: 37<crlf>
Connection: Keep-Alive<crlf>
Cache-Control: no-cache<crlf>
<crlf>
field0=text0&field1=text1&butsub=Send<crlf>
I can't see notably differences between msie request and mine, but on the server I can get all the data (from both pc), but when I send the same request though my client the content message is left (only when the client sends the request from a different pc than the one where server is running).
To send the data from the client I copy the header into a buffer and send it in one time. On the client I have a big buffer to recv the data also in one time (I suppose that form the moment that won't be the problem, if not my server wouldn't be able to get the profesional browsers request).
Have someone had or have seen a problem like that?
Thank's in advance
Niara
P.S. Ok, year-end so have a good new year