Joined: 05 Sep 2006 Posts: 378 Location: The pizza country!
Posted: Sat Mar 24, 2007 12:01 pm Post subject: [Help] Proxy
I'm coding a proxy, it uses blocking sockets with threads, but i'm stuck with the data transfer part.
I haven't got any problem with receiving/sending data from the server, but when i try to receive data from the client, it receives only 1 packet and then it looks like freezed (the client says Cannot access to the server, and if i retry to connect it doesn't receive the packet anymore).
The data transfer code is something like that
Code:
iResult = recv(ServerSocket,buf,DEFAULT_BUFLEN,0);
if (iResult > 0)
{
send(ClientSocket,buf,DEFAULT_BUFLEN,0);
}
else if (iResult == 0)
printf("Server closed the connection");
else
printf("Error.");
Proxy connecting to: xxx.xxx.xxx.xxx:xxxx
Bytes received (Server): 26
Bytes received (Client): 731
Bytes received (Server): 15
Bytes received (Server): 23
... (no more client or received 0 bytes)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum