NanoSocket

NanoSocket - high level wrapper for a nanomsg socket

Constructors

this
this(Protocol protocol, int domain)

constructor

this
this(Protocol protocol, BindTo bindTo, int domain)

constructor

this
this(Protocol protocol, ConnectTo connectTo, int domain)

constructor

Destructor

~this
~this()

destructor

Postblit

this(this)
this(this)

this(this) disabled to avoid sockets being destroyed

Members

Enums

Option
enum Option

nanomsg socket options

Protocol
enum Protocol

nanomsg protocol

Functions

bind
void bind(string uri, string file, size_t line)

bind

close
void close()

close socket

connect
void connect(string uri, string file, size_t line)

connect

getOption
T getOption(Option option)

get socket option value

init
void init(Protocol protocol, int domain)

Same as the revelant constructor, can be used on exisiting objects

init
void init(Protocol protocol, BindTo bindTo, int domain)

Same as the revelant constructor, can be used on exisiting objects

init
void init(Protocol protocol, ConnectTo connectTo, int domain)

Same as the revelant constructor, can be used on exisiting objects

protocol
Protocol protocol()

get protocol

receive
ubyte[] receive(Flag!"blocking" blocking)

receive

send
ubyte[] send(T[] data, Flag!"blocking" blocking, string file, size_t line)

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)

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

Manifest constants

INVALID_FD
enum INVALID_FD;

invalid FD

Meta