Lines Matching refs:sock
290 # define SET_SOCKET_BLOCKING_MODE(sock, save) \ argument
291 save = TRUE; ioctlsocket(sock, FIONBIO, &save)
292 # define RESTORE_SOCKET_BLOCKING_MODE(sock, save) \ argument
293 ioctlsocket(sock, FIONBIO, &save)
296 # define SET_SOCKET_BLOCKING_MODE(sock, save) \ argument
297 save = fcntl(sock, F_GETFL, 0); \
298 fcntl(sock, F_SETFL, save | O_NONBLOCK)
299 # define RESTORE_SOCKET_BLOCKING_MODE(sock, save) \ argument
300 fcntl(sock, F_SETFL, save)
429 php_socket_t sock; local
445 sock = socket(sa->sa_family, socktype, 0);
447 if (sock == SOCK_ERR) {
474 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&sockoptval, sizeof(sockoptval));
479 setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&ipv6_val, sizeof(sockoptval));
484 setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (char*)&sockoptval, sizeof(sockoptval));
489 setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char*)&sockoptval, sizeof(sockoptval));
493 n = bind(sock, sa, socklen);
502 closesocket(sock);
504 sock = -1;
517 return sock;
674 PHPAPI int php_network_get_peer_name(php_socket_t sock, argument
684 if (getpeername(sock, (struct sockaddr*)&sa, &sl) == 0) {
694 PHPAPI int php_network_get_sock_name(php_socket_t sock, argument
704 if (getsockname(sock, (struct sockaddr*)&sa, &sl) == 0) {
786 php_socket_t sock; local
818 sock = socket(sa->sa_family, socktype, 0);
820 if (sock == SOCK_ERR) {
885 if (!local_address || bind(sock, local_address, local_address_len)) {
903 setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char*)&val, sizeof(val));
907 n = php_network_connect_socket(sock, sa, socklen, asynchronous,
944 closesocket(sock);
946 sock = -1;
952 return sock;
1100 php_netstream_data_t *sock; local
1102 sock = pemalloc(sizeof(php_netstream_data_t), persistent_id ? 1 : 0);
1103 memset(sock, 0, sizeof(php_netstream_data_t));
1105 sock->is_blocked = 1;
1106 sock->timeout.tv_sec = FG(default_socket_timeout);
1107 sock->timeout.tv_usec = 0;
1108 sock->socket = socket;
1110 stream = php_stream_alloc_rel(&php_stream_generic_socket_ops, sock, persistent_id, "r+");
1113 pefree(sock, persistent_id ? 1 : 0);