All pastes #551138 Raw Edit

buhtwipe

public text v1 · immutable
·published 2007-06-08 17:38 UTC
rendered paste body
private bool IsMachineAlive (string address)
        {
            IPAddress ipaddy = IPAddress.Parse(address);

            IPEndPoint ipe = new IPEndPoint(ipaddy, 104);
            Socket tempSocket = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
            tempSocket.SendTimeout = 3;

            tempSocket.Connect(ipe);

            if(tempSocket.Connected)
            {
                tempSocket.Close();
                return true;
            }
            else
            {
                return false;
            }
        }