NanoSocket

NanoSocket - high level wrapper for a nanomsg socket

Constructors

this
this(Protocol protocol, int domain = AF_SP)

constructor

this
this(in Protocol protocol, in BindTo bindTo, int domain = AF_SP)

constructor

this
this(in Protocol protocol, in ConnectTo connectTo, int domain = AF_SP)

constructor

Destructor

~this
~this()

destructor

Postblit

this(this)
@disable this(this)

this(this) disabled to avoid sockets being destroyed

Copying this object is disabled.

Members

Enums

Option
enum Option

nanomsg socket options

Protocol
enum Protocol

nanomsg protocol

Functions

bind
void bind(in string uri, in string file = __FILE__, in size_t line = __LINE__)

bind

close
void close()

close socket

connect
void connect(in string uri, in string file = __FILE__, in size_t line = __LINE__)

connect

getOption
T getOption(Option option)

get socket option value

protocol
Protocol protocol()

get protocol

receive
ubyte[] receive(Flag!"blocking" blocking = Yes.blocking)

receive

send
ubyte[] send(T[] data, Flag!"blocking" blocking = Yes.blocking)

Sends the bytes as expected. If the protocol is Request, then returns the response, otherwise returns an empty array.

setOption
inout(NanoSocket) setOption(Option option, T val)

set socket option to a value

toString
string toString()

toString

trySend
ubyte[] trySend(T[] data, Duration duration, Flag!"blocking" recvBlocking = Yes.blocking)

Tries to send bytes to the other side. duration is how long to try for recvBlocking controls whether or not to block on reception of a response. This only matters when the protocol is request/response Returns the response if in request mode, otherwise an empty byte slice.

uri
string uri()

get URI

Variables

INVALID_FD
auto INVALID_FD

invalid FD/// invalid FD

Meta