protected virtual void OnDataSent(ConnectionDataEventArgs e) { var handler = DataSent; if (handler != null) { handler(this, e); } }
public void Parse(ConnectionDataEventArgs e) { incomingStream.AppendData(e.Data.ToArray()); while (incomingStream.IsPacketAvailable()) { var packet = incomingStream.PopPacket(); try { // Logger.LogIncomingPacket(message); Console.WriteLine(string.Format("Recv {0} - {1}: {2}", packet.Length, DateTime.Now.ToLocalTime().TimeOfDay.ToString().Remove(10, 4), packet.ToFormatedHexString())); HandleIncoming(packet); } catch (NotImplementedException) { } catch (Exception ee) { Console.WriteLine(string.Format("Unknown incoming Packet exception: {0}", ee.StackTrace)); } } incomingStream.Flush(); }
void GameServer_DataReceived(object sender, ConnectionDataEventArgs e) { var connection = (Connection)e.Connection; ((IOClient)connection.Client).Parse(e); }
protected virtual void OnDataSent(ConnectionDataEventArgs e) { var handler = DataSent; if (handler != null) handler(this, e); }