ConnectServer() 개인적인 메소드

private ConnectServer ( string host, int port ) : void
host string
port int
리턴 void
예제 #1
0
        public void StartConnect()
        {
            string ip = Singleton <ServiceModel> .GetInstance().GetCurSeverInfo().IP;

            int port = Singleton <ServiceModel> .GetInstance().GetCurSeverInfo().Port;

            client.ConnectServer(ip, port);
        }
예제 #2
0
 public void IniClient()
 {
     client = new SocketClient();
     client.ServerConnected          += Client_ServerConnected;
     client.ServerConnectedException += Client_ServerConnectedException;
     client.ServerDisconnected       += Client_ServerDisconnected;
     client.DataReceived             += Client_DataReceived;
     client.WriteException           += Client_WriteException;
     client.ConnectServer("127.0.0.1", 6666);
 }
    /// <summary>
    /// connect to the server
    /// </summary>
    public void ConnectServer()
    {
        IPAddress ipAddress;

        if (!IPAddress.TryParse(Config.Instance.ServerIP, out ipAddress) || Config.Instance.TcpPort < 0 || Config.Instance.TcpPort > 65535)
        {
            Debug.LogError("ip or port is wrong!");
            return;
        }
        client.ConnectServer(Config.Instance.ServerIP, Config.Instance.TcpPort);
    }
예제 #4
0
 /// <summary>
 /// 发送链接请求
 /// </summary>
 public void SendConnect(string host, string port)
 {
     _socket.ConnectServer(host, port);
     StartCoroutine(ConnectTimeOut(host, port)); //设置超时连接
 }
예제 #5
0
 // 开启网络连接
 public void startConnect(string ip, int port)
 {
     client.ConnectServer(ip, port);
 }