Ejemplo n.º 1
0
        public void Connect(IPAddress address, int inPort, int outPort)
        {
            sender = new PainterSender(lanCanvas, LocalName);
            sender.Connect(address, outPort);
            ServerHandle = sender.Handle;
            TcpListener listener = new TcpListener(IPAddress.Any, inPort);

            listener.Start();
            TcpClient remote = listener.AcceptTcpClient();

            listener.Stop();
            receiver       = new PainterReceiver(remote, lanCanvas);
            RemoteName     = receiver.RemoteName;
            Permissions    = receiver.Permissions;
            ReceiverHandle = receiver.Handle;

            setupHandlers();
        }
Ejemplo n.º 2
0
        public void Listen(IPAddress address, int inPort, int outPort)
        {
            TcpListener listener = new TcpListener(address, inPort);

            listener.Start();
            TcpClient remote = listener.AcceptTcpClient();

            listener.Stop();
            receiver       = new PainterReceiver(remote, lanCanvas);
            Permissions    = receiver.Permissions;
            RemoteName     = receiver.RemoteName;
            ReceiverHandle = receiver.Handle;
            sender         = new PainterSender(lanCanvas, LocalName);
            IPEndPoint endpoint = (IPEndPoint)remote.Client.RemoteEndPoint;

            sender.Connect(endpoint.Address, outPort);
            ServerHandle = sender.Handle;

            setupHandlers();
        }