Пример #1
0
        public void SendObject_SingleObjectIsSentSuccessfully_ReceivedObjectIsCorrect(int port, bool useProtobuf)
        {
            var messageListener = new DataListener <SimpleObject>(port, useProtobuf);

            messageListener.Listen();

            var server = new StreamingServer(port, useProtobuf);

            server.SendObject("John");
            Thread.Sleep(2000);

            var receivedMessages = messageListener.ReceivedObjects.Cast <SimpleObject>();

            receivedMessages.Should().BeEquivalentTo(new SimpleObject
            {
                Name = "John"
            });
        }
Пример #2
0
        /// <summary>
        /// Starts the streaming server.
        /// </summary>
        /// <param name="ipAddress">IP address of the server.</param>
        /// <param name="port">Server port.</param>
        /// <param name="fps">FPS stream.</param>
        private void StartStreamingServer(IPAddress ipAddress, int port, Fps fps)
        {
            if (RbFullScreen.IsChecked == true)
            {
                var  resolution      = GetResolutionFromComboBox(CbScreenResolution.Text);
                bool isDisplayCursor = ChBFullScreenShowCursor.IsChecked != null &&
                                       (bool)ChBFullScreenShowCursor.IsChecked;

                _streamingServer = StreamingServer.GetInstance(resolution, fps, isDisplayCursor);
                _streamingServer.Start(ipAddress, port);
            }
            else if (RbAppWindow.IsChecked == true)
            {
                string applicationName = CbAppWindow.Text;
                bool   isDisplayCursor = ChBAppWindowShowCursor.IsChecked != null &&
                                         (bool)ChBAppWindowShowCursor.IsChecked;

                _streamingServer = StreamingServer.GetInstance(applicationName, fps, isDisplayCursor);
                _streamingServer.Start(ipAddress, port);
            }
        }
Пример #3
0
        public void Dispose()
        {
            if (streaming_server != null)
            {
                streaming_server.Stop();
                streaming_server = null;
            }

            if (proxy_server != null)
            {
                proxy_server.Stop();
                proxy_server = null;
            }

            if (download_manager != null)
            {
                download_manager.Dispose();
                download_manager = null;
            }

            if (upload_manager != null)
            {
                upload_manager.Dispose();
                upload_manager = null;
            }

            if (container != null)
            {
                foreach (ContactSource source in container.Children)
                {
                    Log.DebugFormat("Disposing of ContactSource named {0}", source.Name);
                    source.Contact.ContactServicesChanged -= OnContactServicesChanged;
                    source.Dispose();
                }

                ServiceManager.SourceManager.RemoveSource(container, true);
                container = null;
            }

            if (locator != null)
            {
                locator.ConnectionStatusChanged -= OnConnectionStatusChanged;
                locator.Dispose();
                locator = null;
            }

            foreach (KeyValuePair <string, Connection> kv in conn_map)
            {
                if (kv.Value != null)
                {
                    kv.Value.Roster.RosterStateChanged -= OnRosterStateChanged;
                    kv.Value.Disconnected -= OnDisconnected;
                    kv.Value.Dispose();
                }
            }

            conn_map.Clear();
            source_map.Clear();

            TelepathyNotification notify = TelepathyNotification.Get;

            if (notify != null)
            {
                notify.Dispose();
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            var server = new StreamingServer(15000);

            server.SendMessage("Test");
        }