| 323 | } |
| 324 | |
| 325 | int doRecv(int fd, void* buffer, size_t count, int32_t* host, int32_t* port) |
| 326 | { |
| 327 | sockaddr address; |
| 328 | socklen_t length = sizeof(address); |
| 329 | int r = recvfrom(fd, static_cast<char*>(buffer), count, 0, &address, &length); |
| 330 | |
| 331 | if (r > 0) { |
| 332 | sockaddr_in a; |
| 333 | memcpy(&a, &address, length); |
| 334 | *host = ntohl(a.sin_addr.s_addr); |
| 335 | *port = ntohs(a.sin_port); |
| 336 | } else { |
| 337 | *host = 0; |
| 338 | *port = 0; |
| 339 | } |
| 340 | |
| 341 | return r; |
| 342 | } |
| 343 | |
| 344 | int doWrite(int fd, const void* buffer, size_t count) |
| 345 | { |
no outgoing calls
no test coverage detected