private void Awake() { Instance = this; Notification.Subscribe("ClientMessage", ClientMessage); socketClient = new SocketClient(); socketClient.StartSocketClient(); }
public bool ConnectClient(string ip) { if (_client == null) { _client = new ClientNetManager(config.TransportLayers, config.Serializer); } return(_client.Connect(ip)); }
private void Config() { object o; INSNetSourceCreator nsc; ClientNetManager cnm = new ClientNetManager(); nsc = cnm as INSNetSourceCreator; nsc.Initialize(); nsc.GetNetSourceAdminInterface("http", out o); m_ian = o as IWMSInternalAdminNetSource3; nsc.Shutdown(); }
public static void Main(string[] args) { var client = new ClientNetManager ( new[] { new TransportLayerInfo(new TelepathyTransport(), 1337), new TransportLayerInfo(new MiniUdpTransport(), 1447), }, new CobblestoneSerializer() ); client.RegisterPacket(typeof(PacketMessage)); client.Subscribe(packet => { if (packet is PacketMessage message) { Logger.Log("Server: " + message.text); } }); client.Connect("127.0.0.1"); while (true) { if (Console.KeyAvailable) { var key = Console.ReadKey(true).Key; if (key == ConsoleKey.A) { client.Send(new PacketMessage("Hello there, server!"), 0); } else if (key == ConsoleKey.B) { client.Send(new PacketMessage("Epic mate"), 1); } else if (key == ConsoleKey.Q) { client.Send(new PacketMessage("I'm logging off..."), 0); client.Disconnect(); break; } } client.Update(); Thread.Sleep(16); } }
private void Config() { ClientNetManager cnm = new ClientNetManager(); m_nsc = cnm as INSNetSourceCreator; }