public void Send(IDataCommand dataCommand) { if (AvailableNetworkPoint != null) { Send(dataCommand, AvailableNetworkPoint.IPEndPoint); } else { foreach (var networkPoint in NetworkPoints.GetAll()) { Send(dataCommand, networkPoint.IPEndPoint); } } }
private void OnNetworkClientReceivedData(byte[] data, IPEndPoint receivedFrom) { if (!Datagram.Verify(data, 0, data.Length)) { return; } if (ReceivedDataCommand != null) { var datagram = DatagramFactory.Create(data); ReceivedDataCommand.Invoke(this, NetworkPoints.GetOrAdd(new NetworkPointBase(receivedFrom)), DataCommandFactory.Create(datagram)); } }