Re: reading async from socket

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Alexander

Alexander Nickolov wrote:
WinSock directly supports IOCP model. You use WSARead,
not ReadFile, however. Still, for a client it usually doesn't
make sense going for a server I/O model. You may want to
check out asynchonous socket I/O via WSAAsyncSelect if
you have a GUI application.

thanks for your reply. A few quick questions:

Does using WSARecv means opening the socket using WSASocket with that
overlapped I/O option set? The reason I am asking is the current code
uses plain old socket call to create a socket, which I believe is not
tailor made to use with WSARecv.

So.. what is the best approach for reading enormous amount of data from
a client application, if you need the same kind of performance that you
normally expect from a server app? IOW, my client app needs to
efficiently read the data from the socket and must also be able to
process the response in parallel (when I say 'in parallel' I simply
mean it in the loose sense of the term, like doing it in another
thread). Thats why I wondered whether I should do some kind of async
I/O on the socket and use QueueUserWorkItem subsequently to process the
assembled response packet.

My app is not a GUI app. Its going to run as a NT Service in the end
but for the moment its being built as a plain old console app.

.



Relevant Pages

  • Re: reading async from socket
    ... make sense going for a server I/O model. ... I have a client application that needs to connect to a server via ... the socket? ...
    (microsoft.public.win32.programmer.networks)
  • Re: Detecting clsoed socket on OutputStream.Write
    ... I'm working on the client portion of a client-server app. ... application is fairly straightforward - it sends messages to the server ... client is implemented using the Java Socket class. ...
    (comp.lang.java.programmer)
  • Re: Console app freezes
    ... These are all the things the app does: ... > through a socket to a connected client, ... the system time at the bottom right corner also freezes). ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: TcpClient
    ... If the client is completely finished, it should close the connection gracefully using shutdownor similar API, which will be signaled to you by a successful completion of a receive, with zero bytes. ... But it doesn't do so by providing you a way to poll for the "connectedness" of the socket. ... All that selectis telling you is that some sort of i/o event happened. ...
    (microsoft.public.dotnet.framework)
  • Console app freezes
    ... I’ve written a C# console app that does a lot of things simultaneously. ... The receiving socket listens for incoming commands from a connected client. ... the system time at the bottom right corner also freezes). ...
    (microsoft.public.windowsce.app.development)