public void Listen() { int port = ConfigData.Port; Logger.Log1("Listening on port " + port.ToString()); TCPConnections = new TCPConnectionManager(port, this); TCPConnections.BZFSProtocolConnectionAccepted += BZFSProtocolConnectionAccepted; UDPConnections = new UDPConnectionManager(ServerMessageFactory.Factory); TCPConnections.CheckIPBan = CheckTCPIPBan; TCPConnections.CheckHostBan = CheckTCPHostBan; SecurityArea.Setup(); TCPConnections.StartUp(); UDPConnections.Listen(port); if (ConfigData.ListPublicly) { PubServer.UpdateMasterServer(); Logger.Log1("Listening on port " + port.ToString()); } }
public static void Run(string[] args) { UDPConnectionManager udp = new UDPConnectionManager(null); tcp = new TcpListener(IPAddress.Any, 5154); tcp.Start(); tcp.BeginAcceptTcpClient(TCPClientAccepted, null); udp.AllowAll = true; udp.OutOfBandUDPMessage += Udp_OutOfBandUDPMessage; udp.Listen(5154); UdpClient udpc = new UdpClient("127.0.0.1", 5154); udpc.Send(Encoding.ASCII.GetBytes("hello"), 5); ps = new PublicServer(); ps.Address = "trials.hyperdrive.tech"; ps.Port = 5154; ps.Description = "An unusable test server"; ps.Version = BZFlag.Services.Hosts.ApplicationVersion; ps.Name = "trials.hyperdrive.tech"; ps.Key = args[0]; ps.RequestCompleted += Ps_RequestCompleted; ps.RequestErrored += Ps_RequestErrored; ps.UpdateMasterServer(); bool b = false; while (!b) { lock (locker) b = Done; Thread.Sleep(10); } }