Esempio n. 1
0
 public virtual void AttachSocketListener(NetworkSocket _socket)
 {
     socket            = _socket;
     socket.OnReceive += OnReceive;
     //socket.OnSend += OnSend;
     socket.OnError += OnError;
 }
Esempio n. 2
0
        public void Setup(int localPort, bool _isServer)
        {
            string localIP = "127.0.0.1";

            channel = new NetworkChannel();
            socket  = new NetworkSocket(localIP, localPort);
            socket.SetChannel(channel);

            Console.WriteLine("Binding Socket to: " + localIP + ":" + localPort);
            Console.WriteLine("Binded to: " + socket.socket4.LocalEndPoint.ToString());

            isClient = !isServer;
            isServer = _isServer;

            AttachSocketListener(socket);
            AttachNetworkIdentity();
        }