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)
418 php_socket_t sock; local
450 sock = socket(sa->sa_family, socktype, 0);
452 if (sock == SOCK_ERR) {
459 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&sockoptval, sizeof(sockoptval));
464 setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&ipv6_val, sizeof(sockoptval));
469 setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (char*)&sockoptval, sizeof(sockoptval));
474 setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char*)&sockoptval, sizeof(sockoptval));
479 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char*)&sockoptval, sizeof(sockoptval));
483 n = bind(sock, sa, socklen);
491 closesocket(sock);
493 sock = -1;
506 return sock;
665 PHPAPI int php_network_get_peer_name(php_socket_t sock, argument
675 if (getpeername(sock, (struct sockaddr*)&sa, &sl) == 0) {
685 PHPAPI int php_network_get_sock_name(php_socket_t sock, argument
695 if (getsockname(sock, (struct sockaddr*)&sa, &sl) == 0) {
782 php_socket_t sock; local
839 sock = socket(sa->sa_family, socktype, 0);
841 if (sock == SOCK_ERR) {
876 (void) setsockopt(sock, SOL_IP, IP_BIND_ADDRESS_NO_PORT, &val, sizeof(val));
881 } else if (bind(sock, &local_address.common, local_address_len)) {
895 setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char*)&val, sizeof(val));
904 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char*)&val, sizeof(val));
908 n = php_network_connect_socket(sock, sa, socklen, asynchronous,
944 closesocket(sock);
946 sock = -1;
952 return sock;
1073 php_netstream_data_t *sock; local
1075 sock = pemalloc(sizeof(php_netstream_data_t), persistent_id ? 1 : 0);
1076 memset(sock, 0, sizeof(php_netstream_data_t));
1078 sock->is_blocked = 1;
1079 sock->timeout.tv_sec = FG(default_socket_timeout);
1080 sock->timeout.tv_usec = 0;
1081 sock->socket = socket;
1083 stream = php_stream_alloc_rel(&php_stream_generic_socket_ops, sock, persistent_id, "r+");
1086 pefree(sock, persistent_id ? 1 : 0);