Lines Matching refs:sockfd
121 int sockfd = socket(addr->addr.sa.sa_family, SOCK_DGRAM, 0); in coap_new_endpoint() local
125 if (sockfd < 0) { in coap_new_endpoint()
130 if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0) in coap_new_endpoint()
136 if (setsockopt(sockfd, IPPROTO_IP, IP_PKTINFO, &on, sizeof(on)) < 0) in coap_new_endpoint()
141 if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on)) < 0) in coap_new_endpoint()
144 if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_PKTINFO, &on, sizeof(on)) < 0) in coap_new_endpoint()
153 if (bind(sockfd, &addr->addr.sa, addr->size) < 0) { in coap_new_endpoint()
155 close (sockfd); in coap_new_endpoint()
163 close(sockfd); in coap_new_endpoint()
168 ep->handle.fd = sockfd; in coap_new_endpoint()
172 if (getsockname(sockfd, &ep->addr.addr.sa, &ep->addr.size) < 0) { in coap_new_endpoint()
174 close (sockfd); in coap_new_endpoint()