public void Publish(string queueName, byte[] message, Socket client, uint sequenceID) { var words = new byte[][] { Encoding.UTF8.GetBytes("publish"), Encoding.UTF8.GetBytes(queueName), message }; var sendToClient = PacketCodec.EncodePacket(false, true, sequenceID, words); Send(sendToClient, client); }
/// <summary> /// Sends message to the server. /// </summary> /// <param name="words">Words to send.</param> protected virtual void InternalSend(byte[][] words) { if (!Connected) { LastException = new NotConnectedException(); throw LastException; } var packet = PacketCodec.EncodePacket(false, false, _sequenceID++, words); try { var sendEventArgs = new SocketAsyncEventArgs(); sendEventArgs.Completed += new EventHandler <SocketAsyncEventArgs>(sendEventArgs_Completed); sendEventArgs.SetBuffer(packet, 0, packet.Length); _sock.SendAsync(sendEventArgs); } catch (Exception ex) { Disconnect(); LastException = ex; throw LastException; } }