Ejemplo n.º 1
0
        public void StartServiceServer()
        {
            NetworkMgr networkMgr = NetworkMgr.GetInst();

            networkMgr.mRecv += new EventHandler(OnRecvPacket);
            networkMgr.acceptAsync();
            networkMgr.startAsync();
        }
Ejemplo n.º 2
0
        public int StartServiceClient(string ip, int port)
        {
            NetworkMgr networkMgr = NetworkMgr.GetInst();

            networkMgr.mRecv += new EventHandler(OnRecvPacket);
            int clientID = networkMgr.connectServer(ip, port);

            networkMgr.startAsync();
            return(clientID);
        }
Ejemplo n.º 3
0
        private bool sendMsgToServer(object obj)
        {
            if (clientID == -1)
            {
                return(false);
            }

            byte[] buf = ICD.HEADER.Serialize(obj);
            NetworkMgr.GetInst().WriteToClient(clientID, buf);
            return(true);
        }