Lines Matching refs:sock
65 static int udp_establish_listener (gint *sock);
66 static int udp_check_for_data(gint sock);
71 static gint sock, rd_index, wr_index, buffer_length, prebuffer_length;
323 FD_SET(sock, &set);
324 ret = select(sock + 1, &set, NULL, NULL, &tv);
338 if (read(sock, buf + i, 1) <= 0)
387 sock = socket(AF_INET, SOCK_STREAM, 0);
388 fcntl(sock, F_SETFL, O_NONBLOCK);
413 if (connect(sock, (struct sockaddr *) &address, sizeof (struct sockaddr_in)) == -1)
430 FD_SET(sock, &set);
431 if (select(sock + 1, NULL, &set, NULL, &tv) > 0)
434 getsockopt(sock, SOL_SOCKET, SO_ERROR, &error, &err_len);
500 write(sock, temp, strlen(temp));
501 write(sock, "\r\n", 2);
599 close(sock);
609 return eof ? -1 : sock;
619 sock = http_connect (url, false, offset);
621 if (sock >= 0 && flac_cfg.stream.save_http_stream) {
653 written = read(sock, buffer + wr_index, cnt);
700 if (sock >= 0) {
701 close(sock);
748 static int udp_establish_listener(int *sock)
757 if ((*sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
768 if (bind(*sock, (struct sockaddr *)&sin, sinlen) < 0)
772 close(*sock);
775 if (fcntl(*sock, F_SETFL, O_NONBLOCK) < 0)
779 close(*sock);
784 if (getsockname(*sock, (struct sockaddr *)&sin, &sinlen) < 0)
788 close(*sock);
799 static int udp_check_for_data(int sock)
810 if ((len = recvfrom(sock, buf, 1024, 0, (struct sockaddr *)&from, &fromlen)) < 0)
885 if (sendto(sock, obuf, strlen(obuf), 0, (struct sockaddr *) &from, fromlen) < 0)