G
Guest
Hi. I have an application that uses sockets, as per below:
m_clientSocket = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp );
int iPortNo =8000;
IPEndPoint ipEnd = new IPEndPoint (ip,iPortNo);
m_clientSocket.Connect ( ipEnd );
It works fine, however when I close my application, the application does not
receive any more data via the sockets and the application that sends it the
data (a windows service) must be restarted. I have a similar application that
uses the winsock control with vb6, and this works perfectly and the windows
service never needs to be restarted with the vb6 app, only the .net one.
I have tried different methods to close the socket when i shutdown my .net
app, such as :
m_clientSocket.Shutdown(System.Net.Sockets.SocketShutdown.Both);
m_clientSocket.EndReceive(s);
m_clientSocket.Close();
m_clientSocket = null;
But it makes no difference, the windows service always needs to be
restarted. Does anyone have any ideas at all?
Thank you!
Dave
m_clientSocket = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp );
int iPortNo =8000;
IPEndPoint ipEnd = new IPEndPoint (ip,iPortNo);
m_clientSocket.Connect ( ipEnd );
It works fine, however when I close my application, the application does not
receive any more data via the sockets and the application that sends it the
data (a windows service) must be restarted. I have a similar application that
uses the winsock control with vb6, and this works perfectly and the windows
service never needs to be restarted with the vb6 app, only the .net one.
I have tried different methods to close the socket when i shutdown my .net
app, such as :
m_clientSocket.Shutdown(System.Net.Sockets.SocketShutdown.Both);
m_clientSocket.EndReceive(s);
m_clientSocket.Close();
m_clientSocket = null;
But it makes no difference, the windows service always needs to be
restarted. Does anyone have any ideas at all?
Thank you!
Dave