Socket.receiveWithBlocking

This behaves exactly the same as g_socket_receive(), except that the choice of blocking or non-blocking behavior is determined by the @blocking argument rather than by @socket's properties.

class Socket
ptrdiff_t
receiveWithBlocking

Parameters

buffer char[]

a buffer to read data into (which should be at least @size bytes long).

blocking bool

whether to do blocking or non-blocking I/O

cancellable Cancellable

a %GCancellable or %NULL

Return Value

Type: ptrdiff_t

Number of bytes read, or 0 if the connection was closed by the peer, or -1 on error

Throws

GException on failure.

Meta

Since

2.26