예제 #1
0
        private static TcpClientService GetServiceSimple(string ip, int port)
        {
            TcpClientService tcp = new TcpClientService(ip, port);

            tcp.ConnectTimeout = 500;
            if (tcp.ConnectWithTimeout())
            {
                return(tcp);
            }
            return(null);
        }
예제 #2
0
        public static bool IsOnline(string ip, int port)
        {
            bool             result = false;
            TcpClientService _tcp   = new TcpClientService(ip, port);

            _tcp.ConnectTimeout = 500;
            if (_tcp.ConnectWithTimeout())
            {
                result = true;
            }
            _tcp.Close();
            return(result);
        }