Re: Whats the difference?

Giganews Newsgroups
Subject: Re: Whats the difference?
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Mon, 12 Jun 2006

"Jamie Dale" <j.da…@turboz.net> wrote in message
news:BBFA9E8619FCE240j.da…@turboz.net...

> Whats the difference between AThread.Connection.Disconnect;
>
> AND
>
> AThread.Connection.DisconnectSocket; ??

If you look at the source code, you will see what the difference is.
Disconnect() triggers the OnStatus and OnDisconnect events, and frees the
IOHandler if it was implicitially created.  DisconnectSocket() just closes
the socket and does nothing else.  Disconnect() calls DisconnectSocket().

> They both seem to do the same thing but if I'm going to do this
> the write way I want to be sure I use the correct one.

That depends on where you are disconnecting the socket from to begin with.
If you are closing the socket in the context of the same thread that calls
Connect(), then you should use Disconnect().  If you are closing the socket
in the context of a different thread, then use DisconnectSocket() instead.

Gambit

Replies

In response to

Whats the difference? posted by Jamie Dale on Mon, 12 Jun 2006