Socket

#SoupSocket is libsoup's TCP socket type. While it is primarily intended for internal use, #SoupSocket<!-- -->s are exposed in the API in various places, and some of their methods (eg, soup_socket_get_remote_address()) may be useful to applications.

Constructors

this
this(SoupSocket* soupSocket, bool ownedRef)

Sets our main struct and passes it to the parent class.

Members

Functions

addOnDisconnected
gulong addOnDisconnected(void delegate(Socket) dlg, ConnectFlags connectFlags)

Emitted when the socket is disconnected, for whatever reason.

addOnEvent
gulong addOnEvent(void delegate(GSocketClientEvent, IOStream, Socket) dlg, ConnectFlags connectFlags)

Emitted when a network-related event occurs. See #GSocketClient::event for more details.

addOnNewConnection
gulong addOnNewConnection(void delegate(Socket, Socket) dlg, ConnectFlags connectFlags)

Emitted when a listening socket (set up with soup_socket_listen()) receives a new connection.

addOnReadable
gulong addOnReadable(void delegate(Socket) dlg, ConnectFlags connectFlags)

Emitted when an async socket is readable. See soup_socket_read(), soup_socket_read_until() and #SoupSocket:non-blocking.

addOnWritable
gulong addOnWritable(void delegate(Socket) dlg, ConnectFlags connectFlags)

Emitted when an async socket is writable. See soup_socket_write() and #SoupSocket:non-blocking.

connectAsync
void connectAsync(Cancellable cancellable, SoupSocketCallback callback, void* userData)

Begins asynchronously connecting to @sock's remote address. The socket will call @callback when it succeeds or fails (but not before returning from this function).

connectSync
uint connectSync(Cancellable cancellable)

Attempt to synchronously connect @sock to its remote address.

disconnect
void disconnect()

Disconnects @sock. Any further read or write attempts on it will fail.

getFd
int getFd()

Gets @sock's underlying file descriptor.

getLocalAddress
Address getLocalAddress()

Returns the #SoupAddress corresponding to the local end of @sock.

getRemoteAddress
Address getRemoteAddress()

Returns the #SoupAddress corresponding to the remote end of @sock.

getSocketStruct
SoupSocket* getSocketStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

isConnected
bool isConnected()

Tests if @sock is connected to another host

isSsl
bool isSsl()

Tests if @sock is doing (or has attempted to do) SSL.

listen
bool listen()

Makes @sock start listening on its local address. When connections come in, @sock will emit #SoupSocket::new_connection.

read
SoupSocketIOStatus read(ubyte[] buffer, size_t nread, Cancellable cancellable)

Attempts to read up to @len bytes from @sock into @buffer. If some data is successfully read, soup_socket_read() will return %SOUP_SOCKET_OK, and *@nread will contain the number of bytes actually read (which may be less than @len).

readUntil
SoupSocketIOStatus readUntil(ubyte[] buffer, void* boundary, size_t boundaryLen, size_t nread, bool* gotBoundary, Cancellable cancellable)

Like soup_socket_read(), but reads no further than the first occurrence of @boundary. (If the boundary is found, it will be included in the returned data, and *@got_boundary will be set to %TRUE.) Any data after the boundary will returned in future reads.

startProxySsl
bool startProxySsl(string sslHost, Cancellable cancellable)

Starts using SSL on @socket, expecting to find a host named @ssl_host.

startSsl
bool startSsl(Cancellable cancellable)

Starts using SSL on @socket.

write
SoupSocketIOStatus write(ubyte[] buffer, size_t nwrote, Cancellable cancellable)

Attempts to write @len bytes from @buffer to @sock. If some data is successfully written, the return status will be %SOUP_SOCKET_OK, and *@nwrote will contain the number of bytes actually written (which may be less than @len).

Mixins

__anonymous
mixin InitableT!(SoupSocket)
Undocumented in source.

Static functions

getType
GType getType()

Variables

soupSocket
SoupSocket* soupSocket;

the main Gtk struct

Meta