socket_set_timeout : 'socket -> timout:number? -> void Set the socket send and recv timeout in seconds to the given value (or null for blocking) **/
| 930 | <doc>Set the socket send and recv timeout in seconds to the given value (or null for blocking)</doc> |
| 931 | **/ |
| 932 | void _hx_std_socket_set_timeout( Dynamic o, Dynamic t ) |
| 933 | { |
| 934 | SOCKET sock = val_sock(o); |
| 935 | |
| 936 | #ifdef NEKO_WINDOWS |
| 937 | int time; |
| 938 | if( !t.mPtr ) |
| 939 | time = 0; |
| 940 | else { |
| 941 | time = (int)((double)(t) * 1000); |
| 942 | } |
| 943 | #else |
| 944 | struct timeval time; |
| 945 | if( t.mPtr==0 ) { |
| 946 | time.tv_usec = 0; |
| 947 | time.tv_sec = 0; |
| 948 | } else { |
| 949 | init_timeval(t,&time); |
| 950 | } |
| 951 | #endif |
| 952 | |
| 953 | hx::EnterGCFreeZone(); |
| 954 | if( setsockopt(sock,SOL_SOCKET,SO_SNDTIMEO,(char*)&time,sizeof(time)) != 0 ) |
| 955 | { |
| 956 | hx::ExitGCFreeZone(); |
| 957 | return; |
| 958 | } |
| 959 | if( setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(char*)&time,sizeof(time)) != 0 ) |
| 960 | { |
| 961 | hx::ExitGCFreeZone(); |
| 962 | return; |
| 963 | } |
| 964 | hx::ExitGCFreeZone(); |
| 965 | } |
| 966 | |
| 967 | /** |
| 968 | socket_shutdown : 'socket -> read:bool -> write:bool -> void |
nothing calls this directly
no test coverage detected