/// <summary> /// Called when [TCP client socket received data]. /// </summary> /// <param name="eventObj">The <see cref="Event"/> object.</param> private void OnClientSocketDataReceived(Event eventObj) { SocketEvent socketEvent = (SocketEvent)eventObj; MonoTcpClient tcpClient = socketEvent.TcpClient; ISocketPacket socketPacket = socketEvent.SocketPacket; DispatchEvent(new SocketEvent(SocketEvent.ClientDataReceived, tcpClient, socketPacket)); }
/// <summary> /// Dispatches the event of socket receiving data. /// </summary> /// <param name="packet">The <see cref="ISocketPacket"/> unpacked.</param> protected override void DispatchSocketDataReceivedEvent(ISocketPacket packet) { DispatchEvent(new SocketEvent(SocketEvent.SocketDataReceived, this, packet)); }
/// <summary> /// Initializes a new instance of the <see cref="SocketEvent"/> class with event type and <see cref="MonoTcpClient"/> instance. /// </summary> /// <param name="eventType">The type of the event.</param> /// <param name="client">The instance of <see cref="MonoTcpClient"/>.</param> /// <param name="packet">The <see cref="ISocketPacket"/> unpacked.</param> public SocketEvent(string eventType, MonoTcpClient client, ISocketPacket packet = null) : base(eventType, client) { SocketPacket = packet; }