Re: IOCP question



On May 7, 10:42 pm, Vincent <Vinc...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi,

I would like to write an IOCP server which is act as middle man to receive
the data from client A and pass it to client B

First, when client A and client B connect to the server, i will store both
client socket handles.

First we call WSARecv() with the socket handle from Client A. Server will
able to receive the data from client A.

But after i call WSASend() by using socket handle from Client B in order to
send data from A to B, i able to do it, but after that
GetQueuedCompletionStatus will waiting there for data from Client B.

My question is in order to receive the data from A again, should i call
again WSARecv() after WSASend()?



Hi,

You can use the following APIs to determine the status of one or more
sockets waiting if necessary, just call the API with a timeout & check
the shutdown flag if the timer expires:

select()

WSAAsyncSelect()

http://msdn2.microsoft.com/en-us/library/ms740141(VS.85).aspx

http://msdn2.microsoft.com/en-us/library/ms741540.aspx

http://msdn2.microsoft.com/en-us/library/ms738545(VS.85).aspx

http://tangentsoft.net/wskfaq/

Kellie.

.



Relevant Pages

  • Re: Socket switch delay
    ... both at the client and at the server (and why ... would you set the send buffer size to zero on a non-overlapped ... One glaring error is your client does ... So when you use a single socket, ...
    (microsoft.public.win32.programmer.networks)
  • Re: Locking on async calls
    ... you must synchronize the entire SendMessage routine as an atomic ... operation to prevent mixed messages from being transmitted to the server. ... You are correct that read and write on the socket do not interfere with each ... If you want to handle multiple client connections from one server object ...
    (microsoft.public.dotnet.general)
  • Re: Design issue with WinSock/GetQueuedCompletionStatus
    ... delegate that to a shutdown routine called after all worker threads ... The application I've created is a server accepting connections on a few ... different TCP/IP ports and then lets the client run different commands. ... a TCP/IP socket can be closed for 2 different reasons: ...
    (microsoft.public.win32.programmer.networks)
  • Re: socket communication: socket doesnt connect
    ... Microsoft MVP, MCSD ... As far as your server code goes, ... accept the listening socket. ... Client client = new Client; ...
    (microsoft.public.vc.language)
  • Re: TCP server stop receiving new connections
    ... reset the event mask of your listening socket each time you ... I have a strange problem in my class library used by all our client ... server applications. ... incomming connections, but keeps current connections. ...
    (microsoft.public.win32.programmer.networks)