public void Connect(string ip, int port) { if (IsConnected) { GLog.W("Connect Warrming:: Already Connected!"); return; } OnStateChanged(SocketState.Connecting); IPAddress address = Dns.GetHostAddresses(ip)[0]; IPEndPoint endPoint = new IPEndPoint(address, port); m_socket = new Socket(address.AddressFamily, m_socketType, m_protocolType) { NoDelay = true, SendTimeout = Timeout, ReceiveTimeout = Timeout }; try { m_socket.BeginConnect(endPoint, BeginConnect, m_socket); } catch (Exception e) { GLog.E("Connect Error:: " + e); } }