| 11 | |
| 12 | |
| 13 | int socksend(SOCKET sock, unsigned char * buf, int bufsize, int to){ |
| 14 | int sent = 0; |
| 15 | int res; |
| 16 | struct pollfd fds; |
| 17 | |
| 18 | fds.fd = sock; |
| 19 | fds.events = POLLOUT; |
| 20 | do { |
| 21 | if(conf.timetoexit) return 0; |
| 22 | res = so._poll(&fds, 1, to*1000); |
| 23 | if(res < 0 && (errno == EAGAIN || errno == EINTR)) continue; |
| 24 | if(res < 1) break; |
| 25 | res = so._send(sock, (char *)buf + sent, bufsize - sent, 0); |
| 26 | if(res < 0) { |
| 27 | if(errno == EAGAIN || errno == EINTR) continue; |
| 28 | break; |
| 29 | } |
| 30 | sent += res; |
| 31 | } while (sent < bufsize); |
| 32 | return sent; |
| 33 | } |
| 34 | |
| 35 | |
| 36 | int socksendto(SOCKET sock, struct sockaddr * sin, unsigned char * buf, int bufsize, int to){ |
no outgoing calls
no test coverage detected