I’m trying to implement an IRC client in Unity and I’m hanging when reading from a socket stream. The relevant code looks like this:
sock.Connect(server,port);
if (!sock.Connected)
{
Debug.Log("Failed to connect!");
Application.Quit();
}
socketStream=sock.GetStream();
input = new System.IO.StreamReader(socketStream);
output = new System.IO.StreamWriter(socketStream);
And in update I have Debug.Log(input.ReadLine());
When the the stream runs out the application hangs. Google showed other people had this problem but I didn’t find a solution. There are IRC packages available on the asset store so it should be possible.