SetPort() public method

public SetPort ( int port ) : void
port int
return void
        private void OnConnect(object sender, RoutedEventArgs e)
        {
            string host = Host.Text;
            connector = new PacketProcessing();


            ConnectorSubscribe();
            connector.SetPort(2010);
            connector.SetServerHost(host);
            connector.StartServerConnection();

        }
        public ProxyProcessor(string serverHost, int serverPort, int listeningPort, ProxyType pType, int[] packetFilter)
        {
            PacketProcessing.CrashOnException = false;
            ServerHost = serverHost;
            ServerPort = serverPort;
            if (packetFilter != null)
            {
                filteredPackets = new List<int>(packetFilter);
            }
            else
            {
                filteredPackets = new List<int>();
            }
            proxyType = pType;
            clientProcessor = new PacketProcessing();
            clientProcessor.SetPort(listeningPort);

            Subscribe(clientProcessor);
            
            clientProcessor.StartClientListener();
        }
        private void OnStartServer(object sender, RoutedEventArgs e)
        {
            if (ServerConnection != null)
            {
                ServerConnection.Dispose();
            }
            ServerConnection = new ArtemisComm.PacketProcessing();
            ServerConnection.SetPort(Port);
            ServerConnection.SetServerHost(Host);

            ServerConnection.AudioCommandPacketReceived += conn_AudioCommandPacketReceived;
            ServerConnection.CommsIncomingPacketReceived += conn_CommsIncomingPacketReceived;
            ServerConnection.CommsOutgoingPacketReceived += conn_CommsOutgoingPacketReceived;
            ServerConnection.DestroyObjectPacketReceived += conn_DestroyObjectPacketReceived;
            ServerConnection.EngGridUpdatePacketReceived += conn_EngGridUpdatePacketReceived;
            ServerConnection.GameMessagePacketReceived += conn_GamesMessagePacketReceived;
            ServerConnection.IncomingAudioPacketReceived += conn_IncomingAudioPacketReceived;
            ServerConnection.ObjectStatusUpdatePacketReceived += conn_ObjectStatusUpdatePacketReceived;

            ServerConnection.PackageReceived += conn_PackageReceived;  //This is not necessary (using only for logging) since all other events are subscribed to.

            ServerConnection.ShipActionPacketReceived += conn_ShipActionPacketReceived;
            ServerConnection.ShipAction2PacketReceived += conn_ShipActionPacket2Received;
            ServerConnection.ShipAction3PacketReceived += conn_ShipActionPacket3Received;
            ServerConnection.StationStatusPacketReceived += conn_StationStatusPacketReceived;
            ServerConnection.UndefinedPacketReceived += conn_UndefinedPacketReceived;
            ServerConnection.GameStartPacketReceived += conn_UnknownPacket1Received;
            ServerConnection.Unknown2PacketReceived += conn_UnknownPacket2Received;
            ServerConnection.VersionPacketReceived += conn_VersionPacketReceived;
            ServerConnection.WelcomePacketReceived += conn_WelcomePacketReceived;
            ServerConnection.StartServerConnection();
            btnStartServer.Visibility = Visibility.Collapsed;
            btnStopServer.Visibility = Visibility.Visible;

        }
        void Connect()
        {


            if (!string.IsNullOrEmpty(View.Host) && View.Port > 0)
            {
                Disconnect();
                connector = new PacketProcessing();


                ConnectorSubscribe();
                connector.SetPort(View.Port);
                connector.SetServerHost(View.Host);
                connector.StartServerConnection();

            }
            else
            {
                View.UnableToConnect();
            }
          
        }
        void StartServerConnection()
        {
            if (serverProcessor == null)
            {
                serverProcessor = new PacketProcessing();
                serverProcessor.SetPort(ServerPort);
                serverProcessor.SetServerHost(ServerHost);

                Subscribe(serverProcessor);
                serverProcessor.StartServerConnection();
            }
            else
            {
                if (proxyType == ProxyType.OneServerConnectionToOneClientConnection)
                {
                    serverProcessor.StartServerConnection();

                }
            }

        }