I/O Completion Ports

syrinx

Distinguished
Jan 26, 2005
1
0
18,510
Archived from groups: microsoft.public.windowsnt.protocol.tcpip (More info?)

I started to code a socks5 proxy server with IOCP days ago,and I
encountered a problem.A socks5 proxy server mostly transfers data between
the client and the remote server.

Client <--> Socks Server <--> Remote Server

The problem:
If socks server receives message from client side,and if this I/O
completes,socks server will send the message to the remote server;then the
socks server must issue a new WSARecv() call,but what's the direction to
receive data because there are two situations.

1.If socks server receives the entire message from the client side,it has
to call WSARecv(RemoteServerSocket,.....) to prepare to get data from the
remote server side.
2.If socks server only receives part of the whole message from the client
side,
it has to call WSARecv(ClientSocket,......) to get the rest of the message
form client side.

In short,the problem is how to determine whether we has receives the
entire message from the client side or not.

Is it any way to solve that?

Thanks
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsnt.protocol.tcpip (More info?)

The 2 common used ways : or client message have length as first parameter or
some limit character at the end ( like 0 at the end in Asci string )
Arkady

"Syrinx" <ilovesyrinx@hotmail.com> wrote in message
news:6c40f60cbfb825f51c21eb4b4707e044@localhost.talkaboutsoftware.com...
> I started to code a socks5 proxy server with IOCP days ago,and I
> encountered a problem.A socks5 proxy server mostly transfers data between
> the client and the remote server.
>
> Client <--> Socks Server <--> Remote Server
>
> The problem:
> If socks server receives message from client side,and if this I/O
> completes,socks server will send the message to the remote server;then the
> socks server must issue a new WSARecv() call,but what's the direction to
> receive data because there are two situations.
>
> 1.If socks server receives the entire message from the client side,it has
> to call WSARecv(RemoteServerSocket,.....) to prepare to get data from the
> remote server side.
> 2.If socks server only receives part of the whole message from the client
> side,
> it has to call WSARecv(ClientSocket,......) to get the rest of the message
> form client side.
>
> In short,the problem is how to determine whether we has receives the
> entire message from the client side or not.
>
> Is it any way to solve that?
>
> Thanks
>
>