Lines Matching refs:sd
69 int port = 69, sd = xsocket(TT.af, SOCK_DGRAM, IPPROTO_UDP);
71 xsetsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, (void *)&to, sizeof(struct timeval));
72 xsetsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (void *)&set, sizeof(set));
88 return sd;
132 * Recieves data from server in BUFF with socket SD and updates FROM
135 static ssize_t read_server(int sd, void *buf, size_t len,
144 nb = recvfrom(sd, buf, len, 0, (struct sockaddr *) from, &alen);
159 * sends data to server TO from BUFF of length LEN through socket SD
162 static ssize_t write_server(int sd, void *buf, size_t len,
168 nb = sendto(sd, buf, len, 0, (struct sockaddr *)to,
213 static int read_ack(int sd, uint8_t *packet, struct sockaddr_storage *server,
223 nbytes = read_server(sd, packet, TFTP_IOBUFSIZE, &from);
243 (void) write_server(sd, packet, packetlen, server);
253 (void) write_server(sd, packet, packetlen, server);
272 int len, sd, fd, retry, nbytesrecvd = 0, ndatabytes, ret, result = -1;
274 sd = init_tftp(&server);
280 ret = write_server(sd, packet, len, &server);
291 nbytesrecvd = read_server(sd, packet, TFTP_IOBUFSIZE, &from);
313 ret = write_server(sd, packet, len, &from);
335 ret = write_server(sd, packet, len, &from);
343 ret = write_server(sd, packet, len, &from);
367 ret = write_server(sd, packet, len, &server);
376 errout_with_sd: xclose(sd);
388 int packetlen, sd, fd, retry = 0, ret, result = -1;
390 sd = init_tftp(&server);
396 ret = write_server(sd, packet, packetlen, &server);
398 if (read_ack(sd, packet, &server, &port, NULL) == 0) break;
408 ret = write_server(sd, packet, packetlen, &server);
411 if (read_ack(sd, packet, &server, &port, &rblockno) == 0) {
427 errout_with_sd: close(sd);