asyncronous Socket and EndAccept()

  • Thread starter il RicercatoreSbadato
  • 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?
 
G

Guest

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top