|
|
recv()
is a blocking call so the only way it returns is if all the data has been read or the call is interrupted, for example by a signal or an error. It sounds like it's being interrupted so Zaitas idea of a loop should fix the problem. You will need to test how many bytes have been read and move a pointer along your buffer accordingly for the next call to recv()
|
|
while(r = recv(sockfd, buffer, 128, 0) > 0)
while(recv(sockfd, buffer, 128, 0) > 0)
|
|
mike@Juankubariz:~$ '/home/mike/Desktop/C++/Test' HTTP/1.1 200 OK Date: Thu, 12 Jun 2008 01:52:16 GMT Server: Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6.3 Last-Modified: Wed, 11 Jun 2008 21:36:03 GMT ETag: "5c0113-d-d4d996c0" Accept-Ranges: bytes Content-Length: 13 Connection: close Content-Type: text/plain Hello, thar! ection: close Content-Type: text/plain Hello, thar! |
memset()
the memory you allocate to nulls. This will make sure you don't have any issues.
|
|
|
|
strcat()
, try something like memcpy()
|
|