help
Root Question Message
_port
locally, the clients are also connecting on 127.0.0.1
, so everything is local. I need a way for the server to tell the clients when to actually connect / if its up, originally I wanted to do a filesystem approach where I create an open.txt
file, but that also proved to be bad as the file was always used when clients were originally checking if to connect or not private bool serverIsUp()
{
using (TcpClient tcp = new TcpClient())
{
try
{
tcp.Connect("127.0.0.1", _port);
tcp.Close();
return true;
} catch(Exception)
{
tcp.Close();
return false;
}
}
}
ConnectAsync
method on TcpClient
to avoid blocking.