-------------------------------------------------------------------------*\ * Sendto with timeout \*-------------------------------------------------------------------------*/
| 227 | * Sendto with timeout |
| 228 | \*-------------------------------------------------------------------------*/ |
| 229 | int socket_sendto(p_socket ps, const char *data, size_t count, size_t *sent, |
| 230 | SA *addr, socklen_t len, p_timeout tm) |
| 231 | { |
| 232 | int err; |
| 233 | *sent = 0; |
| 234 | if (*ps == SOCKET_INVALID) return IO_CLOSED; |
| 235 | for ( ;; ) { |
| 236 | int put = sendto(*ps, data, (int) count, 0, addr, len); |
| 237 | if (put > 0) { |
| 238 | *sent = put; |
| 239 | return IO_DONE; |
| 240 | } |
| 241 | err = WSAGetLastError(); |
| 242 | if (err != WSAEWOULDBLOCK) return err; |
| 243 | if ((err = socket_waitfd(ps, WAITFD_W, tm)) != IO_DONE) return err; |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | /*-------------------------------------------------------------------------*\ |
| 248 | * Receive with timeout |
nothing calls this directly
no test coverage detected