Banshee.RemoteListener.RemoteListenerService.StartRemoteListener C# (CSharp) Method

StartRemoteListener() public method

Start remote control socket listener with port given in the preferences.
public StartRemoteListener ( ) : void
return void
        public void StartRemoteListener()
        {
            int port = (int) _prefs["RemoteControl"]["BansheeRemote"]["remote_control_port"].BoxedValue;

            try {
                _listener.Disconnect(false);
            } catch {
            }

            try {
                Log.Information("remote listener start listening on port " + port.ToString());
                IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, port);

                _listener = new Socket(AddressFamily.InterNetwork,
                        SocketType.Stream, ProtocolType.Tcp);
                _listener.Bind(endpoint);
                _listener.Listen(10);
                _listener.BeginAccept(OnIncomingConnection, _listener);
            } catch (Exception e) {
                if (!_disposed) {
                    Log.Error("error while starting remote listener", e.Message);
                }
            }
        }