public CommunicationHandler(IInvokable invokable, IRequestable requestable) { _client = new UdpClient(Properties.Settings.Default.DefaultPort); _client.DataReceived += UdpClient_DataReceived; _client.Start(); Console.WriteLine($"Started listening on udp port: {Properties.Settings.Default.DefaultPort}"); _processor = new DataProcessor(_client, invokable, requestable); }
public CommunicationHandler(int port, IPlayerContainer container, INotifiable notify, IRequestable request) { // TODO: Interface ILobby _playerContainer = container; _tcpListener = new TcpListener(port); _tcpListener.SocketAccepted += SocketAccepted; _tcpListener.Start(); _udpClient = new UdpClient(port); _udpClient.DataReceived += UdpClient_DataReceived; _udpClient.Start(); _processor = new DataProcessor(notify, request); Console.WriteLine("Server started listening on port : {0}", ((IPEndPoint)_tcpListener.Socket.LocalEndPoint).Port); }