private static int Main(string[] args) { if (args.Length != 3) { Console.WriteLine("usage: remote_thr <connect-to> <message-size> <message-count>"); return(1); } string connectTo = args[0]; int messageSize = int.Parse(args[1]); int messageCount = int.Parse(args[2]); using (var push = new PushSocket()) { push.Connect(connectTo); for (int i = 0; i != messageCount; i++) { var msg = new Msg(); msg.InitPool(messageSize); push.Send(ref msg, more: false); msg.Close(); } } return(0); }
public void Send(object content) { if (!ServerSpecified) { return; } Console.WriteLine("Stats send: " + content.GetType().Name + " > " + content); var payload = Serialization.SerializeWithEnvelope(content); sender.Send(payload); }
protected override void Produce(PushSocket socket, int messageSize) { var msg = new byte[messageSize]; msg[messageSize / 2] = 0x42; for (int i = 0; i < MsgCount; i++) { socket.Send(msg); } }
protected override void Produce(PushSocket socket, int messageSize) { var msg = new Msg(); for (int i = 0; i < MsgCount; i++) { msg.InitGC(new byte[messageSize], messageSize); msg.Data[messageSize / 2] = 0x42; socket.Send(ref msg, more: false); msg.Close(); } }
internal void Push2GameServer(PlayerSession session, byte[] data) { var converter = EndianBitConverter.Big; byte[] sendData = new byte[data.Length + 10]; int offset = 0; converter.CopyBytes(session.NetHandle, sendData, 0); offset += 8; converter.CopyBytes((ushort)data.Length, sendData, offset); offset += 2; Buffer.BlockCopy(data, 0, sendData, offset, data.Length); _pushSocket.Send(sendData); }
void OnSend() { try { IMessageEntity msg; if (_msgsWaiting.TryDequeue(out msg)) { byte[] data = msg.Serialize(); _pushSocket.Send(data); } } catch (Exception ex) { Logger.Fatal(ex); } }
public void SendMessage(ClientToServerMessage message) { if (message == null) { return; } if (ctx == null || pushSocket == null) { return; } try { pushSocket.Send(serializer.Serialize(message)); } catch (Exception ex) { logger.Error(ex, "Exception while sending message to server."); } }
public void SendMessage(ClientToServerMessage message) { if (message == null) { return; } if (pushSocket == null) { return; } try { var data = serializer.Serialize(message); var msg = new Msg(); msg.InitGC(data, 0, data.Length); pushSocket.Send(ref msg, false); } catch (Exception ex) { logger.Error(ex, "Exception while sending message to server."); } }
public void Send(byte[] data) { _socket.Send(data); }