Connection

Functions and state needed to maintain a connection.

This is simply to decrease the amount of globals and to create some convenience functions.

Alias This

socket

Implicitly proxies calls to the current Socket. This successfully proxies to Socket.receive.

Members

Functions

getSSLErrorMessage
auto getSSLErrorMessage(int code)

Returns the SSL error message for the passed SSL error code.

receiveTimeout
auto receiveTimeout()

Accessor; returns the current receive timeout.

receiveTimeout
void receiveTimeout(uint dur)

Mutator; sets the receive timeout socket option to the passed duration.

reset
void reset()

(Re-)initialises the sockets and sets the IPv4 one as the active one.

resetSSL
void resetSSL()

Resets the SSL context and resources of this Connection.

sendTimeout
auto sendTimeout()

Accessor; returns the current send timeout.

sendTimeout
void sendTimeout(uint dur)

Mutator; sets the send timeout socket option to the passed duration.

sendline
void sendline(string rawline, uint maxLineLength, string linebreak)

Sends a line to the server.

setDefaultOptions
void setDefaultOptions(Socket socketToSetup)

Sets up sockets with the SocketOptions needed. These include timeouts and buffer sizes.

setup
void setup()

Initialises new Sockets and sets their options.

setupSSL
void setupSSL()

Sets up the SSL context for this connection.

teardown
void teardown()

Shuts down and closes the internal Sockets.

teardownSSL
void teardownSSL()

Frees SSL context and resources.

Variables

certFile
string certFile;

Path to a (.pem) SSL certificate file.

connected
bool connected;

Whether we are connected or not.

ips
Address[] ips;

IPs already resolved using resolveFiber.

privateKeyFile
string privateKeyFile;

Path to a private SSL key file.

socket
Socket socket;

Pointer to the socket of the AddressFamily we want to connect with.

ssl
bool ssl;

Whether or not this Connection should use SSL when sending and receiving.

Meta