Function amqp_tcp_socket_new

Synopsis

#include <librabbitmq/amqp_tcp_socket.h>

amqp_socket_t * amqp_tcp_socket_new(amqp_connection_state_t state)

Description

A TCP socket connection. Create a new TCP socket.

Call amqp_connection_close() to release socket resources.

Return
A new socket object or NULL if an error occurred.
Since
v0.4.0

Mentioned in

Source

Lines 218-229 in librabbitmq/amqp_tcp_socket.c. Line 49 in librabbitmq/amqp_tcp_socket.h.

amqp_socket_t *amqp_tcp_socket_new(amqp_connection_state_t state) {
  struct amqp_tcp_socket_t *self = calloc(1, sizeof(*self));
  if (!self) {
    return NULL;
  }
  self->klass = &amqp_tcp_socket_class;
  self->sockfd = -1;

  amqp_set_socket(state, (amqp_socket_t *)self);

  return (amqp_socket_t *)self;
}





Add Discussion as Guest

Log in to DocsForge