J
John Hynes
Hi,
I have a CompactFramework application that has a socket open to a server
with an asynchronous read to read notification messages from the server and
display them to the user.
I am using NetworkStream.BeginRead to start the read operation.
The problem I have is that when the user chooses to exit the application and
I call NetworkStream.Close and Socket.Shutdown, the application hangs on
exit. The debugger shows that there is one thread left running - the worker
thread for the async read which is still trying to read from the socket.
How do I cancel this read? If I call NetworkStream.EndRead from my main
thread, this just hangs waiting for the read to complete. Unfortunaterly, on
the PocketPC the application window is still visible on the screen and never
goes away.
Thanks
John
I have a CompactFramework application that has a socket open to a server
with an asynchronous read to read notification messages from the server and
display them to the user.
I am using NetworkStream.BeginRead to start the read operation.
The problem I have is that when the user chooses to exit the application and
I call NetworkStream.Close and Socket.Shutdown, the application hangs on
exit. The debugger shows that there is one thread left running - the worker
thread for the async read which is still trying to read from the socket.
How do I cancel this read? If I call NetworkStream.EndRead from my main
thread, this just hangs waiting for the read to complete. Unfortunaterly, on
the PocketPC the application window is still visible on the screen and never
goes away.
Thanks
John