Sockets crashing Unity

I’ve posted the question in Answers also.

Everytime I try to call

Socket soc = listener.AcceptSocket();

Unity crashes, just like a “while(true)” with no “break;”

Help guys :frowning:

The AcceptSocket method is blocking which may cause the behavior you are seeing.

Try using the BeginAcceptSocket instead. TcpListener.BeginAcceptSocket(AsyncCallback, Object) Method (System.Net.Sockets) | Microsoft Learn