C# Class NetMQ.ReceivingSocketExtensions

This static class serves to provide extension methods for IReceivingSocket.
Show file Open project: NetMQ/NetMQ3-x

Public Methods

Method Description
Receive ( this socket, Msg &msg ) : void

Block until the next message arrives, then make the message's data available via msg.

The call blocks until the next message arrives, and cannot be interrupted. This a convenient and safe when you know a message is available, such as for code within a NetMQSocket.ReceiveReady callback.

ReceiveMultipartBytes ( [ socket, List &frames, int expectedFrameCount = 4 ) : void

Receive all frames of the next message from socket, blocking until a message arrives.

ReceiveSignal ( [ socket ) : bool

Receive frames from socket, blocking until a valid signal arrives.

SkipFrame ( [ socket ) : void

Receive a single frame from socket, blocking until one arrives, then ignore its content.

SkipFrame ( [ socket, bool &more ) : void

Receive a single frame from socket, blocking until one arrives, then ignore its content. Indicate whether further frames exist via more.

SkipMultipartMessage ( [ socket ) : void

Receive all frames of the next message from socket, blocking until a message arrives, then ignore their contents.

TryReceiveFrameBytes ( [ socket, System.TimeSpan timeout, byte &bytes ) : bool

Attempt to receive a single frame from socket. If no message is available within timeout, return false.

TryReceiveFrameBytes ( [ socket, System.TimeSpan timeout, byte &bytes, bool &more ) : bool

Attempt to receive a single frame from socket. If no message is available within timeout, return false. Indicate whether further frames exist via more.

TryReceiveFrameBytes ( [ socket, byte &bytes ) : bool

Attempt to receive a single frame from socket. If no message is immediately available, return false.

TryReceiveFrameBytes ( [ socket, byte &bytes, bool &more ) : bool

Attempt to receive a single frame from socket. If no message is immediately available, return false. Indicate whether further frames exist via more.

TryReceiveFrameString ( [ socket, System.TimeSpan timeout, [ encoding, string &frameString ) : bool

Attempt to receive a single frame from socket, and decode as a string using encoding. If no message is available within timeout, return false.

TryReceiveFrameString ( [ socket, System.TimeSpan timeout, [ encoding, string &frameString, bool &more ) : bool

Attempt to receive a single frame from socket, and decode as a string using encoding. If no message is available within timeout, return false.

TryReceiveFrameString ( [ socket, System.TimeSpan timeout, string &frameString ) : bool

Attempt to receive a single frame from socket, and decode as a string using DefaultEncoding. If no message is available within timeout, return false.

TryReceiveFrameString ( [ socket, System.TimeSpan timeout, string &frameString, bool &more ) : bool

Attempt to receive a single frame from socket, and decode as a string using DefaultEncoding. If no message is available within timeout, return false.

TryReceiveFrameString ( [ socket, [ encoding, string &frameString ) : bool

Attempt to receive a single frame from socket, and decode as a string using encoding. If no message is immediately available, return false.

TryReceiveFrameString ( [ socket, [ encoding, string &frameString, bool &more ) : bool

Attempt to receive a single frame from socket, and decode as a string using encoding. If no message is immediately available, return false.

TryReceiveFrameString ( [ socket, string &frameString ) : bool

Attempt to receive a single frame from socket, and decode as a string using DefaultEncoding. If no message is immediately available, return false.

TryReceiveFrameString ( [ socket, string &frameString, bool &more ) : bool

Attempt to receive a single frame from socket, and decode as a string using DefaultEncoding. If no message is immediately available, return false.

TryReceiveMultipartBytes ( [ socket, List &frames, int expectedFrameCount = 4 ) : bool

Attempt to receive all frames of the next message from socket. If no message is immediately available, return false.

TryReceiveMultipartBytes ( [ socket, System.TimeSpan timeout, List &frames, int expectedFrameCount = 4 ) : bool

Attempt to receive all frames of the next message from socket. If no message is available within timeout, return false.

TryReceiveMultipartMessage ( [ socket, System.TimeSpan timeout, [ message, int expectedFrameCount = 4 ) : bool

Attempt to receive all frames of the next message from socket. If no message is available within timeout, return false.

TryReceiveMultipartMessage ( [ socket, [ message, int expectedFrameCount = 4 ) : bool

Attempt to receive all frames of the next message from socket. If no message is immediately available, return false.

TryReceiveMultipartStrings ( [ socket, System.TimeSpan timeout, [ encoding, [ frames, int expectedFrameCount = 4 ) : bool

Attempt to receive all frames of the next message from socket, and decode them as strings using encoding. If no message is available within timeout, return false.

TryReceiveMultipartStrings ( [ socket, System.TimeSpan timeout, [ frames, int expectedFrameCount = 4 ) : bool

Attempt to receive all frames of the next message from socket, and decode them as strings using DefaultEncoding. If no message is available within timeout, return false.

TryReceiveMultipartStrings ( [ socket, [ encoding, [ frames, int expectedFrameCount = 4 ) : bool

Attempt to receive all frames of the next message from socket, and decode them as strings using encoding. If no message is immediately available, return false.

TryReceiveMultipartStrings ( [ socket, [ frames, int expectedFrameCount = 4 ) : bool

Attempt to receive all frames of the next message from socket, and decode them as strings using DefaultEncoding. If no message is immediately available, return false.

TryReceiveSignal ( [ socket, System.TimeSpan timeout, bool &signal ) : bool

Attempt to receive a valid signal from socket. If no message is available within timeout, return false.

TryReceiveSignal ( [ socket, bool &signal ) : bool

Attempt to receive a valid signal from socket. If no message is immediately available, return false.

TrySkipFrame ( [ socket ) : bool

Attempt to receive a single frame from socket, then ignore its content. If no message is immediately available, return false.

TrySkipFrame ( [ socket, System.TimeSpan timeout ) : bool

Attempt to receive a single frame from socket, then ignore its content. If no message is available within timeout, return false.

TrySkipFrame ( [ socket, System.TimeSpan timeout, bool &more ) : bool

Attempt to receive a single frame from socket, then ignore its content. If no message is available within timeout, return false. Indicate whether further frames exist via more.

TrySkipFrame ( [ socket, bool &more ) : bool

Attempt to receive a single frame from socket, then ignore its content. If no message is immediately available, return false. Indicate whether further frames exist via more.

TrySkipMultipartMessage ( [ socket ) : bool

Attempt to receive all frames of the next message from socket, then ignore their contents. If no message is immediately available, return false.

TrySkipMultipartMessage ( [ socket, System.TimeSpan timeout ) : bool

Attempt to receive all frames of the next message from socket, then ignore their contents. If no message is available within timeout, return false.

Private Methods

Method Description
Receive ( [ socket ) : byte[]
Receive ( [ socket, SendReceiveOptions options ) : byte[]
Receive ( [ socket, SendReceiveOptions options, bool &hasMore ) : byte[]
Receive ( [ socket, System.TimeSpan timeout ) : byte[]
Receive ( [ socket, bool &hasMore ) : byte[]
Receive ( [ socket, bool dontWait, bool &hasMore ) : byte[]
ReceiveAll ( [ socket, int expectedFrameCount = 4 ) : List
ReceiveAllString ( [ socket ) : IList
ReceiveFrameBytes ( [ socket ) : byte[]
ReceiveFrameBytes ( [ socket, bool &more ) : byte[]
ReceiveFrameString ( [ socket ) : string
ReceiveFrameString ( [ socket, [ encoding ) : string
ReceiveFrameString ( [ socket, [ encoding, bool &more ) : string
ReceiveFrameString ( [ socket, bool &more ) : string
ReceiveMessage ( [ socket, System.TimeSpan timeout ) : NetMQMessage
ReceiveMessage ( [ socket, bool dontWait = false ) : NetMQMessage
ReceiveMessage ( [ socket, [ message, bool dontWait = false ) : void
ReceiveMessages ( [ socket, int expectedFrameCount = 4 ) : List
ReceiveMultipartBytes ( [ socket, int expectedFrameCount = 4 ) : List
ReceiveMultipartMessage ( [ socket, int expectedFrameCount = 4 ) : NetMQMessage
ReceiveMultipartStrings ( [ socket, [ encoding, int expectedFrameCount = 4 ) : List
ReceiveMultipartStrings ( [ socket, int expectedFrameCount = 4 ) : List
ReceiveString ( [ socket ) : string
ReceiveString ( [ socket, SendReceiveOptions options ) : string
ReceiveString ( [ socket, SendReceiveOptions options, bool &hasMore ) : string
ReceiveString ( [ socket, System.TimeSpan timeout ) : string
ReceiveString ( [ socket, [ encoding ) : string
ReceiveString ( [ socket, [ encoding, SendReceiveOptions options ) : string
ReceiveString ( [ socket, [ encoding, SendReceiveOptions options, bool &hasMore ) : string
ReceiveString ( [ socket, [ encoding, System.TimeSpan timeout ) : string
ReceiveString ( [ socket, [ encoding, bool &hasMore ) : string
ReceiveString ( [ socket, [ encoding, bool dontWait, bool &hasMore ) : string
ReceiveString ( [ socket, bool &hasMore ) : string
ReceiveString ( [ socket, bool dontWait, bool &hasMore ) : string
ReceiveStringMessages ( [ socket, [ encoding, int expectedFrameCount = 4 ) : List
ReceiveStringMessages ( [ socket, int expectedFrameCount = 4 ) : List
WaitForSignal ( [ socket ) : bool

Method Details

Receive() public static method

Block until the next message arrives, then make the message's data available via msg.
The call blocks until the next message arrives, and cannot be interrupted. This a convenient and safe when you know a message is available, such as for code within a NetMQSocket.ReceiveReady callback.
public static Receive ( this socket, Msg &msg ) : void
socket this The socket to receive from.
msg Msg An object to receive the message's data into.
return void

ReceiveMultipartBytes() public static method

Receive all frames of the next message from socket, blocking until a message arrives.
public static ReceiveMultipartBytes ( [ socket, List &frames, int expectedFrameCount = 4 ) : void
socket [ The socket to receive from.
frames List Reference to a list for return values. If null a new instance will be assigned, otherwise the provided list will be cleared and populated.
expectedFrameCount int Optional initial for the returned .
return void

ReceiveSignal() public static method

Receive frames from socket, blocking until a valid signal arrives.
public static ReceiveSignal ( [ socket ) : bool
socket [ The socket to receive from.
return bool

SkipFrame() public static method

Receive a single frame from socket, blocking until one arrives, then ignore its content.
public static SkipFrame ( [ socket ) : void
socket [ The socket to receive from.
return void

SkipFrame() public static method

Receive a single frame from socket, blocking until one arrives, then ignore its content. Indicate whether further frames exist via more.
public static SkipFrame ( [ socket, bool &more ) : void
socket [ The socket to receive from.
more bool true if another frame of the same message follows, otherwise false.
return void

SkipMultipartMessage() public static method

Receive all frames of the next message from socket, blocking until a message arrives, then ignore their contents.
public static SkipMultipartMessage ( [ socket ) : void
socket [ The socket to receive from.
return void

TryReceiveFrameBytes() public static method

Attempt to receive a single frame from socket. If no message is available within timeout, return false.
public static TryReceiveFrameBytes ( [ socket, System.TimeSpan timeout, byte &bytes ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
bytes byte The content of the received message frame, or null if no message was available.
return bool

TryReceiveFrameBytes() public static method

Attempt to receive a single frame from socket. If no message is available within timeout, return false. Indicate whether further frames exist via more.
public static TryReceiveFrameBytes ( [ socket, System.TimeSpan timeout, byte &bytes, bool &more ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
bytes byte The content of the received message frame, or null if no message was available.
more bool true if another frame of the same message follows, otherwise false.
return bool

TryReceiveFrameBytes() public static method

Attempt to receive a single frame from socket. If no message is immediately available, return false.
public static TryReceiveFrameBytes ( [ socket, byte &bytes ) : bool
socket [ The socket to receive from.
bytes byte The content of the received message frame, or null if no message was available.
return bool

TryReceiveFrameBytes() public static method

Attempt to receive a single frame from socket. If no message is immediately available, return false. Indicate whether further frames exist via more.
public static TryReceiveFrameBytes ( [ socket, byte &bytes, bool &more ) : bool
socket [ The socket to receive from.
bytes byte The content of the received message frame, or null if no message was available.
more bool true if another frame of the same message follows, otherwise false.
return bool

TryReceiveFrameString() public static method

Attempt to receive a single frame from socket, and decode as a string using encoding. If no message is available within timeout, return false.
public static TryReceiveFrameString ( [ socket, System.TimeSpan timeout, [ encoding, string &frameString ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
encoding [ The encoding used to convert the frame's data to a string.
frameString string The content of the received message frame as a string, or null if no message was available.
return bool

TryReceiveFrameString() public static method

Attempt to receive a single frame from socket, and decode as a string using encoding. If no message is available within timeout, return false.
public static TryReceiveFrameString ( [ socket, System.TimeSpan timeout, [ encoding, string &frameString, bool &more ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
encoding [ The encoding used to convert the frame's data to a string.
frameString string The content of the received message frame as a string, or null if no message was available.
more bool true if another frame of the same message follows, otherwise false.
return bool

TryReceiveFrameString() public static method

Attempt to receive a single frame from socket, and decode as a string using DefaultEncoding. If no message is available within timeout, return false.
public static TryReceiveFrameString ( [ socket, System.TimeSpan timeout, string &frameString ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
frameString string The content of the received message frame as a string, or null if no message was available.
return bool

TryReceiveFrameString() public static method

Attempt to receive a single frame from socket, and decode as a string using DefaultEncoding. If no message is available within timeout, return false.
public static TryReceiveFrameString ( [ socket, System.TimeSpan timeout, string &frameString, bool &more ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
frameString string The content of the received message frame as a string, or null if no message was available.
more bool true if another frame of the same message follows, otherwise false.
return bool

TryReceiveFrameString() public static method

Attempt to receive a single frame from socket, and decode as a string using encoding. If no message is immediately available, return false.
public static TryReceiveFrameString ( [ socket, [ encoding, string &frameString ) : bool
socket [ The socket to receive from.
encoding [ The encoding used to convert the frame's data to a string.
frameString string The content of the received message frame as a string, or null if no message was available.
return bool

TryReceiveFrameString() public static method

Attempt to receive a single frame from socket, and decode as a string using encoding. If no message is immediately available, return false.
public static TryReceiveFrameString ( [ socket, [ encoding, string &frameString, bool &more ) : bool
socket [ The socket to receive from.
encoding [ The encoding used to convert the frame's data to a string.
frameString string The content of the received message frame as a string, or null if no message was available.
more bool true if another frame of the same message follows, otherwise false.
return bool

TryReceiveFrameString() public static method

Attempt to receive a single frame from socket, and decode as a string using DefaultEncoding. If no message is immediately available, return false.
public static TryReceiveFrameString ( [ socket, string &frameString ) : bool
socket [ The socket to receive from.
frameString string The content of the received message frame as a string, or null if no message was available.
return bool

TryReceiveFrameString() public static method

Attempt to receive a single frame from socket, and decode as a string using DefaultEncoding. If no message is immediately available, return false.
public static TryReceiveFrameString ( [ socket, string &frameString, bool &more ) : bool
socket [ The socket to receive from.
frameString string The content of the received message frame as a string, or null if no message was available.
more bool true if another frame of the same message follows, otherwise false.
return bool

TryReceiveMultipartBytes() public static method

Attempt to receive all frames of the next message from socket. If no message is immediately available, return false.
public static TryReceiveMultipartBytes ( [ socket, List &frames, int expectedFrameCount = 4 ) : bool
socket [ The socket to receive from.
frames List Reference to a list for return values. If null a new instance will be assigned, otherwise the provided list will be cleared and populated.
expectedFrameCount int Optional initial for the returned .
return bool

TryReceiveMultipartBytes() public static method

Attempt to receive all frames of the next message from socket. If no message is available within timeout, return false.
public static TryReceiveMultipartBytes ( [ socket, System.TimeSpan timeout, List &frames, int expectedFrameCount = 4 ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
frames List Reference to a list for return values. If null a new instance will be assigned, otherwise the provided list will be cleared and populated.
expectedFrameCount int Optional initial for the returned .
return bool

TryReceiveMultipartMessage() public static method

Attempt to receive all frames of the next message from socket. If no message is available within timeout, return false.
public static TryReceiveMultipartMessage ( [ socket, System.TimeSpan timeout, [ message, int expectedFrameCount = 4 ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
message [ The received message. Untouched if no message was available.
expectedFrameCount int Specifies the initial capacity of the used /// to buffer results. If the number of frames is known, set it here. If more frames arrive than expected, /// an extra allocation will occur, but the result will still be correct.
return bool

TryReceiveMultipartMessage() public static method

Attempt to receive all frames of the next message from socket. If no message is immediately available, return false.
public static TryReceiveMultipartMessage ( [ socket, [ message, int expectedFrameCount = 4 ) : bool
socket [ The socket to receive from.
message [ The received message. Untouched if no message was available.
expectedFrameCount int Specifies the initial capacity of the used /// to buffer results. If the number of frames is known, set it here. If more frames arrive than expected, /// an extra allocation will occur, but the result will still be correct.
return bool

TryReceiveMultipartStrings() public static method

Attempt to receive all frames of the next message from socket, and decode them as strings using encoding. If no message is available within timeout, return false.
public static TryReceiveMultipartStrings ( [ socket, System.TimeSpan timeout, [ encoding, [ frames, int expectedFrameCount = 4 ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
encoding [ The encoding used to convert the frame's data to a string.
frames [ The frames of the received message as strings. Untouched if no message was available.
expectedFrameCount int Specifies the initial capacity of the used /// to buffer results. If the number of frames is known, set it here. If more frames arrive than expected, /// an extra allocation will occur, but the result will still be correct.
return bool

TryReceiveMultipartStrings() public static method

Attempt to receive all frames of the next message from socket, and decode them as strings using DefaultEncoding. If no message is available within timeout, return false.
public static TryReceiveMultipartStrings ( [ socket, System.TimeSpan timeout, [ frames, int expectedFrameCount = 4 ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
frames [ The frames of the received message as strings. Untouched if no message was available.
expectedFrameCount int Specifies the initial capacity of the used /// to buffer results. If the number of frames is known, set it here. If more frames arrive than expected, /// an extra allocation will occur, but the result will still be correct.
return bool

TryReceiveMultipartStrings() public static method

Attempt to receive all frames of the next message from socket, and decode them as strings using encoding. If no message is immediately available, return false.
public static TryReceiveMultipartStrings ( [ socket, [ encoding, [ frames, int expectedFrameCount = 4 ) : bool
socket [ The socket to receive from.
encoding [ The encoding used to convert the frame's data to a string.
frames [ The frames of the received message as strings. Untouched if no message was available.
expectedFrameCount int Specifies the initial capacity of the used /// to buffer results. If the number of frames is known, set it here. If more frames arrive than expected, /// an extra allocation will occur, but the result will still be correct.
return bool

TryReceiveMultipartStrings() public static method

Attempt to receive all frames of the next message from socket, and decode them as strings using DefaultEncoding. If no message is immediately available, return false.
public static TryReceiveMultipartStrings ( [ socket, [ frames, int expectedFrameCount = 4 ) : bool
socket [ The socket to receive from.
frames [ The frames of the received message as strings. Untouched if no message was available.
expectedFrameCount int Specifies the initial capacity of the used /// to buffer results. If the number of frames is known, set it here. If more frames arrive than expected, /// an extra allocation will occur, but the result will still be correct.
return bool

TryReceiveSignal() public static method

Attempt to receive a valid signal from socket. If no message is available within timeout, return false.
public static TryReceiveSignal ( [ socket, System.TimeSpan timeout, bool &signal ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
signal bool true if the received signal was zero, otherwise false. If no signal received, false.
return bool

TryReceiveSignal() public static method

Attempt to receive a valid signal from socket. If no message is immediately available, return false.
public static TryReceiveSignal ( [ socket, bool &signal ) : bool
socket [ The socket to receive from.
signal bool true if the received signal was zero, otherwise false. If no signal received, false.
return bool

TrySkipFrame() public static method

Attempt to receive a single frame from socket, then ignore its content. If no message is immediately available, return false.
public static TrySkipFrame ( [ socket ) : bool
socket [ The socket to receive from.
return bool

TrySkipFrame() public static method

Attempt to receive a single frame from socket, then ignore its content. If no message is available within timeout, return false.
public static TrySkipFrame ( [ socket, System.TimeSpan timeout ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
return bool

TrySkipFrame() public static method

Attempt to receive a single frame from socket, then ignore its content. If no message is available within timeout, return false. Indicate whether further frames exist via more.
public static TrySkipFrame ( [ socket, System.TimeSpan timeout, bool &more ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
more bool true if another frame of the same message follows, otherwise false.
return bool

TrySkipFrame() public static method

Attempt to receive a single frame from socket, then ignore its content. If no message is immediately available, return false. Indicate whether further frames exist via more.
public static TrySkipFrame ( [ socket, bool &more ) : bool
socket [ The socket to receive from.
more bool true if another frame of the same message follows, otherwise false.
return bool

TrySkipMultipartMessage() public static method

Attempt to receive all frames of the next message from socket, then ignore their contents. If no message is immediately available, return false.
public static TrySkipMultipartMessage ( [ socket ) : bool
socket [ The socket to receive from.
return bool

TrySkipMultipartMessage() public static method

Attempt to receive all frames of the next message from socket, then ignore their contents. If no message is available within timeout, return false.
public static TrySkipMultipartMessage ( [ socket, System.TimeSpan timeout ) : bool
socket [ The socket to receive from.
timeout System.TimeSpan The maximum period of time to wait for a message to become available.
return bool