static void Main(string[] args) { Console.Title = "JHS Server Gateway"; NetConfig.logFilter = JHSLogFilter.Developer; JHSNetworkServer.RegisterHandler(100, TESTMSG_RECIVE); JHSNetworkServer.Start("0.0.0.0"); timer1 = new Timer(); timer1.Elapsed += OnTimedEvent; timer1.Interval = 200; // in miliseconds timer1.Start(); Console.ReadKey(); }
public void Disconnect() { stage = PerStage.NotConnected; try { if (m_socket != null) { m_socket.Close(); } } catch { } if (isClient) { JHSNetworkClient.Disconnect(this); } else { JHSNetworkServer.Disconnect(this); } }
public bool Disconnect(JHSConnection con) { if (con != null) { uint conId = con.connectionId; JHSNetworkServer.PushMessage(new JHSNetworkMessage { msgType = InternalMessages.DISCONNECT, conn = con, reader = new JHSNetworkReader() }); JHSStatisiticsManager.Remove(con); lock (m_Connections) { if (m_Connections.ContainsKey(conId)) { m_Connections.Remove(conId); } } con.Dispose(); } return(true); }