static void Server(int count) { UdpSocket[] sockets = new UdpSocket[count]; for (int i = 0; i < count; ++i) { sockets[i] = UdpSocket.Create <UdpPlatformManaged, DummySerializer>(); sockets[i].Start(new UdpEndPoint(UdpIPv4Address.Localhost, (ushort)(14000 + i))); } UdpSocketMultiplexer multiplexer = UdpSocket.CreateMultiplexer(sockets); while (true) { UdpEvent ev; UdpSocket socket; while (multiplexer.Poll(out ev, out socket)) { UdpLog.User("Event raised {0}", ev.EventType); switch (ev.EventType) { case UdpEventType.Connected: UdpLog.User("Client connected from {0}", ev.Connection.RemoteEndPoint); break; } } // Simulate ~60fps game loop Thread.Sleep(16); } }