Reading socket is slow - C
|
|
while ((return_count = socket_read(socket_number, &receive_str[i], 5120)) > 0) This will loop until the server closes the connection, which is exactly why it's taking your 30 to 45 seconds before it actually 'stops'. Webservers keep the connection with the client open for that long in case the client has more requests to send. if(i > RECVSTRSIZE); The semicolon at the end of your line will make this if do 'nothing'. Since by default most socket operations are blocking, I would suggest using select() to first check if there is actually something to read. |
|