Hi
I use this code to connect:
//Connect asynchronously
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
pendingConnect = socket.BeginConnect(connectThreadMessage.RemoteEnd Point,
new AsyncCallback(AsyncOperationCompleteCallback), socket);
then in the callback I pass the message back to my thread and use this code:
socket.EndConnect(pendingConnect);
socket.Close();
socket = null;
Everytime I execute this task manager shows the handle count for my process
increasing by 1. If I force a garbage collection then all the handles get
released.
Peter
"Nicholas Paldino [.NET/C# MVP]" wrote:
Peter,
Can you show sample code showing how you are closing these things? It
would seem that you are closing all the right things, but without seeing the
code, it is hard to tell.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Peter Chapman" <Pe**********@discussions.microsoft.com> wrote in message
news:1A**********************************@microsof t.com... Hi
I am using the BeginConnect function on my socket but I am not exactly
sure
how I am supposed to clean up after this call.
After the connecion attempt has completed I call EndConnect passing in the
IAsyncResult I received from the BeginConnect and then I close the socket.
However when I look in Task Manager the handle count for my program goes
up
everytime I run this function. I tried closing the AsyncWaitHandle of the
IAsyncResult too but that didn't seem to help either.
Thanks in Advance
Peter Chapman