日期:2014-05-17 浏览次数:20922 次
  public bool conn(string ip, int port)
        {
            try
            {
                IPAddress hostIP = IPAddress.Parse(ip);// 这句上按F10后,就报异常了
                IPEndPoint ipLocalEndPoint = new IPEndPoint(hostIP, port);
                llrpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);                
                llrpSocket.Connect(ipLocalEndPoint);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }