Logo Search packages:      
Sourcecode: libnl version File versions  Download package

int nl_set_buffer_size ( struct nl_handle *  handle,
int  rxbuf,
int  txbuf 

Set socket buffer size of netlink handle.

  • handle Netlink handle.
  • rxbuf New receive socket buffer size in bytes.
  • txbuf New transmit socket buffer size in bytes.
Sets the socket buffer size of a netlink handle to the specified values rxbuf and txbuf. Providing a value of 0 assumes a good default value.

It is not required to call this function prior to nl_connect().
0 on sucess or a negative error code.

Definition at line 214 of file nl.c.

Referenced by nl_connect().

      int err;

      if (rxbuf <= 0)
            rxbuf = 32768;

      if (txbuf <= 0)
            txbuf = 32768;
      err = setsockopt(handle->h_fd, SOL_SOCKET, SO_SNDBUF,
                   &txbuf, sizeof(txbuf));
      if (err < 0)
            return nl_error(errno, "setsockopt(SO_SNDBUF) failed");

      err = setsockopt(handle->h_fd, SOL_SOCKET, SO_RCVBUF,
                   &rxbuf, sizeof(rxbuf));
      if (err < 0)
            return nl_error(errno, "setsockopt(SO_RCVBUF) failed");

      handle->h_flags |= NL_SOCK_BUFSIZE_SET;

      return 0;

Generated by  Doxygen 1.6.0   Back to index