Lines Matching refs:fd
92 int fd = -1;
99 fd = socket(addr_is_ip6(addr, *addrlen)?PF_INET6:PF_INET,
101 if(fd == -1) {
109 if(connect(fd, (struct sockaddr*)addr, *addrlen) < 0) {
117 return fd;
143 /** write a query over the TCP fd */
145 write_q(int fd, int udp, SSL* ssl, sldns_buffer* buf, uint16_t id,
250 if(send(fd, (void*)&len, sizeof(len), 0) <
269 if(send(fd, (void*)sldns_buffer_begin(buf),
289 recv_one(int fd, int udp, SSL* ssl, sldns_buffer* buf)
306 ssize_t r = recv(fd, (void*)&len, sizeof(len), 0);
334 if(recv(fd, (void*)sldns_buffer_begin(buf), len, 0) <
348 if((l=recv(fd, (void*)sldns_buffer_begin(buf),
377 print_any_answers(int fd, int udp, SSL* ssl, sldns_buffer* buf,
380 /* see if the fd can read, if so, print one answer, repeat */
388 FD_SET(fd, &rfd);
391 ret = select(fd+1, &rfd, NULL, NULL, waittv);
402 recv_one(fd, udp, ssl, buf);
444 int fd = open_svr(svr, udp, &svr_addr, &svr_addrlen);
459 ssl = outgoing_ssl_fd(ctx, fd);
491 if(send(fd, (void*)sldns_buffer_begin(proxy_buf),
513 write_q(fd, udp, ssl, buf, (uint16_t)get_random(), proxy_buf,
519 print_any_answers(fd, udp, ssl, buf, &wait_results, 0);
521 recv_one(fd, udp, ssl, buf);
525 print_any_answers(fd, udp, ssl, buf, &wait_results, 1);
532 sock_close(fd);