Function amqp_open_socket_noblock

Synopsis

#include <librabbitmq/amqp_socket.h>

int amqp_open_socket_noblock(char const *hostname, int portnumber, const struct timeval *timeout)

Description

Open a socket connection.

This function opens a socket connection returned from amqp_tcp_socket_new() or amqp_ssl_socket_new(). This function should be called after setting socket options and prior to assigning the socket to an AMQP connection with amqp_set_socket().

Parameters:

[ in ] host - Connect to this host.

[ in ] port - Connect on this remote port.

[ in ] timeout - Max allowed time to spent on opening. If NULL - run in blocking mode

Return
File descriptor upon success, non-zero negative error code otherwise.

Source

Lines 314-322 in librabbitmq/amqp_socket.c. Line 160 in librabbitmq/amqp_socket.h.

int amqp_open_socket_noblock(char const *hostname, int portnumber,
                             const struct timeval *timeout) {
  amqp_time_t deadline;
  int res = amqp_time_from_now(&deadline, timeout);
  if (AMQP_STATUS_OK != res) {
    return res;
  }
  return amqp_open_socket_inner(hostname, portnumber, deadline);
}





Add Discussion as Guest

Log in to DocsForge