- Home /
Question by
DGDGJOHN · Jun 09, 2018 at 07:50 PM ·
c#networkingtcp
How do I keep Unity from stopping my Threaded TcpListener.AcceptTcpClient()
I am trying to open a server in another thread in my unity project but every time I listen for a connection I get an System.Net.Sockets.SocketException: A blocking operation was interrupted by a call to WSACancelBlockingCall.
I open my Thread as follows:
ThreadStart ts = new ThreadStart(HandleMessages);
messageHandler = new Thread(ts);
messageHandler.IsBackground = true;
messageHandler.Start();
And I am calling
TcpClient tcpClient = tcpListener.AcceptTcpClient();
When I open the server outside of the thread it works fine. Any Idea what is happening or how to fix it?
Comment