asyncronous Socket and EndAccept()

  • Thread starter Thread starter il RicercatoreSbadato
  • Start date Start date
I

il RicercatoreSbadato

title: asyncronous Socket and EndAccept()

question: hi to all, I am working with a server that uses the sockets in a
asyncronous way. When I want to STOP the server I do the following:
- serverMainSocket.EndAccept();
- serverMainSocket.Shutdown(SocketShutdown.Both);
- serverMainSocket.Close();
My problem is on the first instruction. I don't know what can I put as
argument in the EndAccept().

I've tried with

IAsyncResult asyn;
serverMainSocket.EndAccept(asyn);

but this is seen like an error.

Any ideas?
 
Hi,

EndAccept() is used in your callback method for ending a connection request
for a socket in a listening state. It has nothing to do with closing the
socket. Remove the EndAccept() line and you're right on.

Good luck!
 
Back
Top