Lines Matching refs:sock
287 # define SET_SOCKET_BLOCKING_MODE(sock, save) \ argument
288 save = TRUE; ioctlsocket(sock, FIONBIO, &save)
289 # define RESTORE_SOCKET_BLOCKING_MODE(sock, save) \ argument
290 ioctlsocket(sock, FIONBIO, &save)
293 # define SET_SOCKET_BLOCKING_MODE(sock, save) \ argument
294 save = fcntl(sock, F_GETFL, 0); \
295 fcntl(sock, F_SETFL, save | O_NONBLOCK)
296 # define RESTORE_SOCKET_BLOCKING_MODE(sock, save) \ argument
297 fcntl(sock, F_SETFL, save)
459 php_socket_t sock; in php_network_bind_socket_to_local_addr() local
491 sock = socket(sa->sa_family, socktype, 0); in php_network_bind_socket_to_local_addr()
493 if (sock == SOCK_ERR) { in php_network_bind_socket_to_local_addr()
500 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&sockoptval, sizeof(sockoptval)); in php_network_bind_socket_to_local_addr()
505 setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&ipv6_val, sizeof(sockoptval)); in php_network_bind_socket_to_local_addr()
510 setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (char*)&sockoptval, sizeof(sockoptval)); in php_network_bind_socket_to_local_addr()
515 setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char*)&sockoptval, sizeof(sockoptval)); in php_network_bind_socket_to_local_addr()
520 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char*)&sockoptval, sizeof(sockoptval)); in php_network_bind_socket_to_local_addr()
524 n = bind(sock, sa, socklen); in php_network_bind_socket_to_local_addr()
532 closesocket(sock); in php_network_bind_socket_to_local_addr()
534 sock = -1; in php_network_bind_socket_to_local_addr()
547 return sock; in php_network_bind_socket_to_local_addr()
706 PHPAPI int php_network_get_peer_name(php_socket_t sock, in php_network_get_peer_name() argument
716 if (getpeername(sock, (struct sockaddr*)&sa, &sl) == 0) { in php_network_get_peer_name()
726 PHPAPI int php_network_get_sock_name(php_socket_t sock, in php_network_get_sock_name() argument
736 if (getsockname(sock, (struct sockaddr*)&sa, &sl) == 0) { in php_network_get_sock_name()
822 php_socket_t sock; in php_network_connect_socket_to_host() local
873 sock = socket(sa->sa_family, socktype, 0); in php_network_connect_socket_to_host()
875 if (sock == SOCK_ERR) { in php_network_connect_socket_to_host()
910 (void) setsockopt(sock, SOL_IP, IP_BIND_ADDRESS_NO_PORT, &val, sizeof(val)); in php_network_connect_socket_to_host()
915 } else if (bind(sock, &local_address.common, local_address_len)) { in php_network_connect_socket_to_host()
929 setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char*)&val, sizeof(val)); in php_network_connect_socket_to_host()
938 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char*)&val, sizeof(val)); in php_network_connect_socket_to_host()
942 n = php_network_connect_socket(sock, sa, socklen, asynchronous, in php_network_connect_socket_to_host()
978 closesocket(sock); in php_network_connect_socket_to_host()
980 sock = -1; in php_network_connect_socket_to_host()
986 return sock; in php_network_connect_socket_to_host()
1107 php_netstream_data_t *sock; in _php_stream_sock_open_from_socket() local
1109 sock = pemalloc(sizeof(php_netstream_data_t), persistent_id ? 1 : 0); in _php_stream_sock_open_from_socket()
1110 memset(sock, 0, sizeof(php_netstream_data_t)); in _php_stream_sock_open_from_socket()
1112 sock->is_blocked = 1; in _php_stream_sock_open_from_socket()
1113 sock->timeout.tv_sec = FG(default_socket_timeout); in _php_stream_sock_open_from_socket()
1114 sock->timeout.tv_usec = 0; in _php_stream_sock_open_from_socket()
1115 sock->socket = socket; in _php_stream_sock_open_from_socket()
1117 stream = php_stream_alloc_rel(&php_stream_generic_socket_ops, sock, persistent_id, "r+"); in _php_stream_sock_open_from_socket()
1120 pefree(sock, persistent_id ? 1 : 0); in _php_stream_sock_open_from_socket()