public int Run ()
{
client = new TcpClient ();
IPEndPoint ipep = new IPEndPoint (IPAddress.Loopback, 9999);
try {
client.Connect (ipep);
} catch (SocketException) {
Console.WriteLine ("Failed to connect. Exiting...");
return 1;
}
while (true) {
int len = client.GetStream ().ReadByte ();
if (len < 0) {
return 0;
}
byte [] bytes = new byte [len];
client.GetStream ().Read (bytes, 0, len);
}
}
}