public void TransportPacket(Who recipient, FlexBuffer buf) { byte[] sendBytes = buf.GetAvailBytes(); if (listener != null) { IPEndPoint ipe = remoteIpEndPoint; if (recipient != null) { if (!(recipient is WhoSender)) { throw new Exception("unknown recipient"); } ipe = (recipient as WhoSender).sender; } if (ipe == null) { throw new Exception("unknown receiver"); } listener.Send(sendBytes, sendBytes.Length, ipe); } else { udpClient.Send(sendBytes, sendBytes.Length); } }