ldns_tcp_connect(3)

ldns_tcp_connect3

Tcp queries

Usage

#include <stdint.h>
#include <stdbool.h>

#include <ldns/ldns.h>

ssize_t ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen);

uint8_t* ldns_tcp_read_wire(int sockfd, size_t *size);

int ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout);

Overview

ldns_tcp_send_query() send a query via tcp to a server. Don't want for the answer

.br qbin: the buffer to send .br sockfd: the socket to use .br to: which ip to send it .br tolen: socketlen .br Returns number of bytes sent

ldns_tcp_read_wire() This routine may block. Use ldns_tcp_read_wire_timeout, it checks timeouts. Gives back a raw packet from the wire and reads the header data from the given socket. Allocates the data (of size size) itself, so don't forget to free

.br sockfd: the socket to read from .br size: the number of bytes that are read .br Returns the data read

ldns_tcp_connect() Create a tcp socket to the specified address This function has the flaw that it returns 0 on failure, but 0 could be a valid socket. Please use ldns_tcp_connect2 instead of this function. .br to: ip and family .br tolen: length of to .br timeout: timeout for the connect attempt .br Returns a socket descriptor or 0 on failure

Remarks

This manpage was automatically generated from the ldns source code.

Releases

10 releases since Debian 5.0 (Lenny); the text changed 5 times.

  1. 5.0
  2. 6.0–8
  3. 9–10
  4. 11–12
  5. 13
  6. Arch

Author

The ldns team at NLnet Labs.

Reporting bugs

Please report bugs to [email protected] or on GitHub at https://github.com/NLnetLabs/ldns/issues

From ldns 1.9.2-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.