/// <summary> /// Sends the byte[] message and uses the specified flags to configure the sending behavior. /// </summary> /// <param name="source"></param> /// <param name="message">The byte array to send</param> /// <param name="flags">Send flags configuring the sending operation</param> public static void Send(this IZmqSocket source, byte[] message, SendFlags flags) { bool hasMore = (flags & SendFlags.SendMore) != 0; bool doNotWait = (flags & SendFlags.DoNotWait) != 0; source.Send(message, hasMore, doNotWait); }
/// <summary> /// Sends data over the socket with flags set. /// </summary> /// <param name="flags"></param> /// <param name="data">The message part(s). Sending without a value set will result in sending a zero-length message, not a null.</param> /// <returns>True if the data was sent successfully; otherwise, false.</returns> public bool Send(SendFlags flags, params byte[][] data) { Contract.Requires(!Disposed); if (data.Length == 0) { return(SendOne(new byte[0], flags)); } if (data.Length == 1) { return(SendOne(data[0], flags)); } else if (data.Length > 1) { for (int i = 0; i < data.Length - 1; i++) { if (SendOne(data[i], flags | SendFlags.MoreToFollow) == false) { return(false); } } return(SendOne(data.Last(), flags)); } return(true); }
public Result SendMessageToConnection(Connection connection, byte[] data, SendFlags flags) { if (data == null) throw new ArgumentNullException("data"); return SendMessageToConnection(connection, data, data.Length, flags); }
public override void Send(byte[] buffer, SendFlags flags) { if (Disconnected || !socket.Connected) { return; } // TODO: Low priority sending support try { if ((flags & SendFlags.Synchronous) != 0) { socket.Send(buffer, 0, buffer.Length, SocketFlags.None); return; } lock (sendLock) { if (sendInProgress) { sendQueue.Enqueue(buffer); } else { sendInProgress = TrySendAsync(buffer); } } } catch (SocketException) { Disconnect(); } catch (ObjectDisposedException) { // Socket was already closed by another thread } }
private bool SendOne(byte[] data, SendFlags flags) { Contract.Requires(!Disposed); Contract.Requires(data != null); if (C.zmq_msg_init_size(m_msg, data.Length) != 0) { throw ZeroMQException.CurrentError(); } Marshal.Copy(data, 0, C.zmq_msg_data(m_msg), data.Length); int rc = C.zmq_send(m_sock, m_msg, (int)flags); C.zmq_msg_close(m_msg); if (rc == 0) { return(true); } else if (C.zmq_errno() == C.EAGAIN) { return(false); } else { throw ZeroMQException.CurrentError(); } }
public void Send(Byte[] data, SendFlags flags, OnSent onSent) { if (connected) { client.SendMessageToConnection(connection, data, flags); onSent?.Invoke(); } }
public override void Send(byte[] buffer, SendFlags flags) { try { lock (locker) ssl.Write(buffer); } catch (Exception ex) { Logger.LogError("Error writing to secure stream", ex); } }
public void SendToAll(Byte[] data, SendFlags flags) { if (ServerActive()) { foreach (UInt32 connectedId in connectedClients.ToArray()) { SendTo(connectedId, data, flags); } } }
public void SendToAllPlayers(Byte[] data, SendFlags flags) { if (ServerActive()) { foreach (Player player in sgr.pm.players) { SendTo(player.id, data, flags); } } }
private bool SendMail(string subject, string body, SendFlags flags) { MapiMessage message = new MapiMessage(); message.subject = subject; message.noteText = body; message.recips = GetRecipients(out message.recipCount); message.files = GetAttachments(out message.fileCount); lastError = (MessageApiError)MAPISendMail(IntPtr.Zero, IntPtr.Zero, message, flags, 0); Cleanup(message); return(lastError == MessageApiError.Success); }
public void SendTo(int playerID, NetworkPacket sendData, int timeOut, out int asyncHandle, SendFlags flags, object context) { throw new NotImplementedException(); }
public Result SendMessageToConnection(Connection connection, byte[] data, int length, SendFlags flags) { if (data == null) throw new ArgumentNullException("data"); return Native.SteamAPI_ISteamNetworkingSockets_SendMessageToConnection(nativeSockets, connection, data, (uint)length, flags, IntPtr.Zero); }
internal static extern Result SteamAPI_ISteamNetworkingSockets_SendMessageToConnection(IntPtr sockets, Connection connection, byte[] data, uint length, SendFlags flags, IntPtr outMessageNumber);
public void Send(NetworkPacket sendData, int timeOut, out int asyncHandle, SendFlags flags) { throw new NotImplementedException(); }
public void SendTo(UInt32 connectionID, string data, SendFlags flags) { SendTo(connectionID, Encoding.ASCII.GetBytes(data), flags); }
/// <summary> Sends a block of data. </summary> public abstract void Send(byte[] buffer, SendFlags flags);
public void Send(GCHandle gcbuffer, int bufferSize, int timeOut, out int asyncHandle, SendFlags flags) { throw new NotImplementedException(); }
public void SendTo(int playerID, GCHandle gcbuffer, int bufferSize, int timeOut, SendFlags flags) { throw new NotImplementedException(); }
private static extern int MAPISendMail(IntPtr session, IntPtr hWnd, MapiMessage message, SendFlags flags, uint reserved);
/// <summary> /// Sends data over the socket with flags set. /// </summary> /// <param name="flags"></param> /// <param name="data">The message part(s). Sending without a value set will result in sending a zero-length message, not a null.</param> /// <returns>True if the data was sent successfully; otherwise, false.</returns> public bool Send( SendFlags flags, params byte[][] data ) { Contract.Requires( !Disposed ); if( data.Length == 0 ) { return SendOne( new byte[0], flags ); } if( data.Length == 1 ) { return SendOne( data[0], flags ); } else if( data.Length > 1 ) { for( int i = 0; i < data.Length - 1; i++ ) { if( SendOne( data[i], flags | SendFlags.MoreToFollow ) == false ) { return false; } } return SendOne( data.Last(), flags ); } return true; }
private bool SendOne( byte[] data, SendFlags flags ) { Contract.Requires( !Disposed ); Contract.Requires( data != null ); if( C.zmq_msg_init_size( m_msg, data.Length ) != 0 ) { throw ZeroMQException.CurrentError(); } Marshal.Copy( data, 0, C.zmq_msg_data( m_msg ), data.Length ); int rc = C.zmq_send( m_sock, m_msg, (int)flags ); C.zmq_msg_close( m_msg ); if( rc == 0 ) { return true; } else if( C.zmq_errno() == C.EAGAIN ) { return false; } else { throw ZeroMQException.CurrentError(); } }
private bool SendMail(string subject, string body, SendFlags flags) { MapiMessage message = new MapiMessage(); message.subject = subject; message.noteText = body; message.recips = GetRecipients(out message.recipCount); message.files = GetAttachments(out message.fileCount); lastError = (MessageApiError)MAPISendMail(IntPtr.Zero, IntPtr.Zero, message, flags, 0); Cleanup(message); return lastError == MessageApiError.Success; }
public void SendTo(UInt32 connectionID, byte[] data, SendFlags flags) { server.SendMessageToConnection(connectionID, data, flags); }
protected override void SendRaw(byte[] data, SendFlags flags) { s.Send(data, flags); }
protected override void SendRaw(byte[] data, SendFlags flags) { lock (sendLock) stream.Write(data); }
public override void Send(byte[] buffer, SendFlags flags) { s.Send(WrapData(buffer), flags); }
public Result SendMessageToConnection(Connection connection, IntPtr data, uint length, SendFlags flags) { return SendMessageToConnection(connection, data, length, flags); }
public void Send(GCHandle gcbuffer, int bufferSize, int timeOut, SendFlags flags, object context) { throw new NotImplementedException(); }
public Result SendMessageToConnection(Connection connection, IntPtr data, int length, SendFlags flags) { return Native.SteamAPI_ISteamNetworkingSockets_SendMessageToConnection(nativeSockets, connection, data, (uint)length, flags, IntPtr.Zero); }
public void Send(NetworkPacket sendData, int timeOut, SendFlags flags, object context) { throw new NotImplementedException(); }
public void SendTo(int playerID, NetworkPacket sendData, int timeOut, SendFlags flags) { throw new NotImplementedException(); }
public void SendTo(int playerID, GCHandle gcbuffer, int bufferSize, int timeOut, out int asyncHandle, SendFlags flags, object context) { throw new NotImplementedException(); }
/// <summary> Sends data to the underlying socket without wrapping the data in a websocket frame </summary> protected abstract void SendRaw(byte[] data, SendFlags flags);