Ejemplo n.º 1
0
 private void ListenerThreadProc()
 {
     while (true)
     {
         TransportClient client = AcceptClient();
         listener.OnAcceptClient(client);
     }
 }
Ejemplo n.º 2
0
        public TransportClient AcceptClient()
        {
            TcpClient       tcpClient;
            TransportClient client;

            tcpClient         = tcpListener.AcceptTcpClient();
            tcpClient.NoDelay = true;

            client = new TransportClient(tcpClient);

            return(client);
        }
Ejemplo n.º 3
0
        public TransportClient AcceptClient()
        {
            TcpClient tcpClient;
            TransportClient client;

            tcpClient = tcpListener.AcceptTcpClient();
            tcpClient.NoDelay = true;

            client = new TransportClient(tcpClient);

            return client;
        }
Ejemplo n.º 4
0
 static void ThreadProc(TransportClient client)
 {
     try
     {
         while (client.isConnected())
         {
             client.RecvPDU();
             Thread.Sleep(10);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
     }
 }
Ejemplo n.º 5
0
        /**
         * Class constructor
         */
        public Client(TransportClient transport, IClientListener clientListener)
        {
            this.clientListener = clientListener;

            dispatcher = new ChannelDispatcher();

            transport.SetChannelDispatcher(dispatcher);

            surfaceServer = new SurfaceServer(transport, this);
            dispatcher.RegisterChannel(surfaceServer);

            sessionServer = new SessionServer(transport, this);
            dispatcher.RegisterChannel(sessionServer);

            inputServer = new InputServer(transport, this);
            dispatcher.RegisterChannel(inputServer);

            transport.StartThread();

            dispatcher.OnConnect();
        }
Ejemplo n.º 6
0
        /**
         * Class constructor
         */
        public Client(TransportClient transport, IClientRequestListener listener)
            : base(transport)
        {
            this.thread = new Thread(ReceiverThreadProc);
            thread.Start();

            this.listener = listener;
            this.transport = transport;
            dispatcher = new ChannelDispatcher();

            transport.SetChannelDispatcher(dispatcher);

            surface = new Surface(this.transport);
            dispatcher.RegisterChannel(surface);

            session = new Session(this.transport, this);
            dispatcher.RegisterChannel(session);

            dispatcher.OnConnect();

            transport.StartThread();
        }
Ejemplo n.º 7
0
    /**
     * Is invoked when application launches. Connects the Client to the Server
     */
    public void OnUserConnect(string address, int port)
    {
        ChannelDispatcher dispatcher = new ChannelDispatcher();
        this.transport = new TransportClient(dispatcher);

        sessionClient = new SessionClient(this.transport, this);
        dispatcher.RegisterChannel(sessionClient);

        surfaceClient = new SurfaceClient(this, this.transport);
        dispatcher.RegisterChannel(surfaceClient);

        inputClient = new InputClient(this.transport);
        dispatcher.RegisterChannel(inputClient);

        try
        {
            this.transport.Connect(address, port);
            DisplayStatusText("Welcome! You are connected to Screenary server at " + address + " : " + port);
        }
        catch (TransportException e)
        {
            ExceptionDialog exception = new ExceptionDialog("Operation Fail", "Could not connect to Screenary server at "
                + address + " : " + port + "\nVerify connections.");
        }
    }
Ejemplo n.º 8
0
 static void ThreadProc(TransportClient client)
 {
     try
     {
         while (client.isConnected())
         {
             client.RecvPDU();
             Thread.Sleep(10);
         }
     }
     catch(Exception e)
     {
         Console.WriteLine(e.ToString());
     }
 }
Ejemplo n.º 9
0
 public SurfaceServer(TransportClient transport, ISurfaceServer listener)
 {
     this.transport = transport;
     this.listener = listener;
 }
Ejemplo n.º 10
0
    public MainWindow(int m)
        : base(Gtk.WindowType.Toplevel)
    {
        Build();

        /* Instantiate client states */
        clientStates = new IClientState[4] {
            new StartedState(this),
            new SenderCreatedState(this),
            new ReceiverJoinedState(this),
            new ReceiverAuthenticatedState(this)
        };

        /* Set current state to STARTED */
        currentState = clientStates[STARTED_STATE];

        mode = m;
        width = 1024;
        height = 768;

        config = Config.Load();

        window = mainDrawingArea.GdkWindow;
        drawable = (Gdk.Drawable) window;

        gc = new Gdk.GC(drawable);
        gc.ClipRectangle = new Gdk.Rectangle(0, 0, width, height);

        surface = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, width, height);
        window.InvalidateRect(new Gdk.Rectangle(0, 0, width, height), true);

        receiver = new SurfaceReceiver(window, surface);

        OutOfSessionWindow();

        this.transport = null;

        rdpSource = new RdpSource(this);
        pcapSource = new PcapSource(this);

        if (config.BroadcasterAutoconnect)
            OnUserConnect(config.BroadcasterHostname, config.BroadcasterPort);
    }
Ejemplo n.º 11
0
 public SessionServer(TransportClient transport, ISessionRequestListener listener)
 {
     this.transport = transport;
     this.listener  = listener;
 }
Ejemplo n.º 12
0
 public SessionServer(TransportClient transport, ISessionRequestListener listener)
 {
     this.transport = transport;
     this.listener = listener;
 }
Ejemplo n.º 13
0
 public InputClient(TransportClient transport)
 {
     this.transport = transport;
     this.listener  = null;
     this.active    = false;
 }
Ejemplo n.º 14
0
 public SessionClient(TransportClient transport, ISessionResponseListener listener)
 {
     this.transport = transport;
     this.listener  = listener;
     this.sessionId = 0;
 }
Ejemplo n.º 15
0
 static void ThreadProc(TransportClient client)
 {
     while (true)
     {
         client.RecvPDU();
         Thread.Sleep(10);
     }
 }
Ejemplo n.º 16
0
 public SurfaceClient(ISurfaceClient client, TransportClient transport)
 {
     this.client    = client;
     this.transport = transport;
 }
Ejemplo n.º 17
0
 public SurfaceServer(TransportClient transport, ISurfaceServer listener)
 {
     this.transport = transport;
     this.listener  = listener;
 }
Ejemplo n.º 18
0
    public MainWindow(int m)
        : base(Gtk.WindowType.Toplevel)
    {
        Build();

        /* Instantiate client states */
        clientStates = new IClientState[7]
        {
            new StartedState(this),
            new SenderCreatedState(this),
            new ReceiverJoinedState(this),
            new ReceiverAuthenticatedState(this),
            new SenderSendingState(this),
            new ReceiverInControlState(this),
            new SenderSendingRemoteState(this)
        };

        /* Set current state to STARTED */
        currentState = clientStates[STARTED_STATE];
        currentState.refresh();

        width = 1024;
        height = 768;

        config = Config.Load();

        window = mainDrawingArea.GdkWindow;
        drawable = (Gdk.Drawable) window;

        mainDrawingArea.AddEvents(
            (int) Gdk.EventMask.ButtonPressMask |
            (int) Gdk.EventMask.ButtonReleaseMask |
            (int) Gdk.EventMask.PointerMotionMask |
            (int) Gdk.EventMask.KeyPressMask |
            (int) Gdk.EventMask.KeyReleaseMask);

        gc = new Gdk.GC(drawable);
        gc.ClipRectangle = new Gdk.Rectangle(0, 0, width, height);

        surface = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, width, height);
        window.InvalidateRect(new Gdk.Rectangle(0, 0, width, height), true);

        receiver = new SurfaceReceiver(window, surface);

        this.transport = null;

        pcapSource = new PcapSource(this);

        keyboard = new Keyboard();

        if (config.BroadcasterAutoconnect)
            OnUserConnect(config.BroadcasterHostname, config.BroadcasterPort);
    }
Ejemplo n.º 19
0
 public InputClient(TransportClient transport)
 {
     this.transport = transport;
     this.listener = null;
     this.active = false;
 }
Ejemplo n.º 20
0
 public SessionClient(TransportClient transport, ISessionResponseListener listener)
 {
     this.transport = transport;
     this.listener = listener;
     this.sessionId = 0;
 }
Ejemplo n.º 21
0
 public void OnAcceptClient(TransportClient transportClient)
 {
     Console.WriteLine("Broadcaster.OnAcceptClient");
     Client client = new Client(transportClient, SessionManager.Instance);
     clients.TryAdd(transportClient, client);
 }
Ejemplo n.º 22
0
 public SurfaceClient(ISurfaceClient client, TransportClient transport)
 {
     this.client = client;
     this.transport = transport;
 }
Ejemplo n.º 23
0
 public SurfaceServer(TransportClient transport)
 {
     this.transport = transport;
 }
Ejemplo n.º 24
0
 public void OnAcceptClient(TransportClient transportClient)
 {
     Console.WriteLine("OnAcceptClient");
     new Client(transportClient, ScreenSessions.Instance);
 }
Ejemplo n.º 25
0
    public void OnUserConnect(string address, int port)
    {
        ChannelDispatcher dispatcher = new ChannelDispatcher();
        this.transport = new TransportClient(dispatcher);

        session = new Session(this.transport, this);
        dispatcher.RegisterChannel(session);

        SurfaceClient surface = new SurfaceClient(this, this.transport);
        dispatcher.RegisterChannel(surface);

        this.transport.Connect(address, port);

        Console.WriteLine("connected to screenary server at {0}:{1}", address, port);
        notificationBar.Push (id, "Welcome! You are connected to Screenary server at " + address + " : " + port);
    }