Example #1
0
        private void Start()
        {
            switch (socketType)
            {
            case SocketType.TcpClient: socket = new TcpClient(address, port); break;

            case SocketType.TcpServer: socket = new TcpServer(port); break;

            case SocketType.UdpClient: socket = new UdpClient(address, port); break;
            }
            socket.Launch();
            if (openHearBeat)
            {
                hearBeat = gameObject.AddComponent <HearBeatComponent>();
                hearBeat.Init(socket);
            }
            EventManager.Instance.Regist(MsgID.ConnectSuccess, ConnectSuccess);
            EventManager.Instance.Regist(MsgID.ConnectFailed, ConnectFailed);
            Application.runInBackground = true;
        }
Example #2
0
 public void Launch()
 {
     socket.Launch();
 }