コード例 #1
0
 private void ListenerThreadProc()
 {
     while (true)
     {
         TransportClient client = AcceptClient();
         listener.OnAcceptClient(client);
     }
 }
コード例 #2
0
        public TransportClient AcceptClient()
        {
            TcpClient       tcpClient;
            TransportClient client;

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

            client = new TransportClient(tcpClient);

            return(client);
        }
コード例 #3
0
        public TransportClient AcceptClient()
        {
            TcpClient tcpClient;
            TransportClient client;

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

            client = new TransportClient(tcpClient);

            return client;
        }
コード例 #4
0
ファイル: TransportClient.cs プロジェクト: arif-sb/Screenary
 static void ThreadProc(TransportClient client)
 {
     try
     {
         while (client.isConnected())
         {
             client.RecvPDU();
             Thread.Sleep(10);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
     }
 }
コード例 #5
0
ファイル: Client.cs プロジェクト: awakecoding/Screenary
        /**
         * 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();
        }
コード例 #6
0
ファイル: Client.cs プロジェクト: marwansamaha/Screenary
        /**
         * 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();
        }
コード例 #7
0
ファイル: MainWindow.cs プロジェクト: Screenary/Screenary
    /**
     * 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.");
        }
    }
コード例 #8
0
 static void ThreadProc(TransportClient client)
 {
     try
     {
         while (client.isConnected())
         {
             client.RecvPDU();
             Thread.Sleep(10);
         }
     }
     catch(Exception e)
     {
         Console.WriteLine(e.ToString());
     }
 }
コード例 #9
0
 public SurfaceServer(TransportClient transport, ISurfaceServer listener)
 {
     this.transport = transport;
     this.listener = listener;
 }
コード例 #10
0
ファイル: MainWindow.cs プロジェクト: marwansamaha/Screenary
    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);
    }
コード例 #11
0
 public SessionServer(TransportClient transport, ISessionRequestListener listener)
 {
     this.transport = transport;
     this.listener  = listener;
 }
コード例 #12
0
 public SessionServer(TransportClient transport, ISessionRequestListener listener)
 {
     this.transport = transport;
     this.listener = listener;
 }
コード例 #13
0
 public InputClient(TransportClient transport)
 {
     this.transport = transport;
     this.listener  = null;
     this.active    = false;
 }
コード例 #14
0
ファイル: SessionClient.cs プロジェクト: arif-sb/Screenary
 public SessionClient(TransportClient transport, ISessionResponseListener listener)
 {
     this.transport = transport;
     this.listener  = listener;
     this.sessionId = 0;
 }
コード例 #15
0
 static void ThreadProc(TransportClient client)
 {
     while (true)
     {
         client.RecvPDU();
         Thread.Sleep(10);
     }
 }
コード例 #16
0
 public SurfaceClient(ISurfaceClient client, TransportClient transport)
 {
     this.client    = client;
     this.transport = transport;
 }
コード例 #17
0
 public SurfaceServer(TransportClient transport, ISurfaceServer listener)
 {
     this.transport = transport;
     this.listener  = listener;
 }
コード例 #18
0
ファイル: MainWindow.cs プロジェクト: Screenary/Screenary
    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);
    }
コード例 #19
0
ファイル: InputClient.cs プロジェクト: awakecoding/Screenary
 public InputClient(TransportClient transport)
 {
     this.transport = transport;
     this.listener = null;
     this.active = false;
 }
コード例 #20
0
 public SessionClient(TransportClient transport, ISessionResponseListener listener)
 {
     this.transport = transport;
     this.listener = listener;
     this.sessionId = 0;
 }
コード例 #21
0
ファイル: Broadcaster.cs プロジェクト: awakecoding/Screenary
 public void OnAcceptClient(TransportClient transportClient)
 {
     Console.WriteLine("Broadcaster.OnAcceptClient");
     Client client = new Client(transportClient, SessionManager.Instance);
     clients.TryAdd(transportClient, client);
 }
コード例 #22
0
 public SurfaceClient(ISurfaceClient client, TransportClient transport)
 {
     this.client = client;
     this.transport = transport;
 }
コード例 #23
0
 public SurfaceServer(TransportClient transport)
 {
     this.transport = transport;
 }
コード例 #24
0
ファイル: Broadcaster.cs プロジェクト: marwansamaha/Screenary
 public void OnAcceptClient(TransportClient transportClient)
 {
     Console.WriteLine("OnAcceptClient");
     new Client(transportClient, ScreenSessions.Instance);
 }
コード例 #25
0
ファイル: MainWindow.cs プロジェクト: marwansamaha/Screenary
    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);
    }