void ProcessReceivedData(SocketState connection, byte[] buffer, int bufferSize) { //Console.WriteLine("--Send:{0}, Packet: {1}", tunnel.Name, Encoding.UTF8.GetString(buffer.Take(bufferSize).ToArray())); byte[] sendBuffer = Packetizer.AssembleMessagePacket(buffer, bufferSize, false, null, null); connection.Peer.Socket.Send(sendBuffer, sendBuffer.Length, SocketFlags.None); }
private void SendPacketEnvelope(SocketState connection, PacketEnvelope envelope) { byte[] sendBuffer = Packetizer.AssembleMessagePacket(envelope, false, null, null); connection.Socket.Send(sendBuffer, sendBuffer.Length, SocketFlags.None); }
private void SendPacketEnvelope(SocketState connection, PacketEnvelope envelope, string encryptionKey, string salt) { byte[] sendBuffer = Packetizer.AssembleMessagePacket(envelope, true, encryptionKey, salt); connection.Socket.Send(sendBuffer, sendBuffer.Length, SocketFlags.None); }