MPD 0.17~git
Data Structures | Functions
src/tcp_connect.h File Reference
#include <glib.h>

Go to the source code of this file.

Data Structures

struct  tcp_connect_handler

Functions

void tcp_connect_address (const struct sockaddr *address, size_t address_length, unsigned timeout_ms, const struct tcp_connect_handler *handler, void *ctx, struct tcp_connect **handle_r)
 Establish a TCP connection to the specified address.
void tcp_connect_cancel (struct tcp_connect *handle)
 Cancel the operation.
void tcp_connect_free (struct tcp_connect *handle)
 Free memory used by this object.

Function Documentation

void tcp_connect_address ( const struct sockaddr *  address,
size_t  address_length,
unsigned  timeout_ms,
const struct tcp_connect_handler handler,
void *  ctx,
struct tcp_connect **  handle_r 
)

Establish a TCP connection to the specified address.

Note that the result may be available before this function returns.

The caller must free this object with tcp_connect_free().

Parameters:
timeout_mstime out after this number of milliseconds; 0 means no timeout
handle_ra handle that can be used to cancel the operation; the caller must initialize it to NULL
void tcp_connect_cancel ( struct tcp_connect *  handle)

Cancel the operation.

It is possible that the result is delivered before the operation has been canceled; in that case, the canceled() handler method will not be invoked.

Even after calling this function, tcp_connect_free() must still be called to free memory.

void tcp_connect_free ( struct tcp_connect *  handle)

Free memory used by this object.

This function is not thread safe. It must not be called while other threads are still working with it. If no callback has been invoked so far, then you must call tcp_connect_cancel() to release I/O thread resources, before calling this function.