| 324 | } |
| 325 | |
| 326 | void UDPSocket::sendTo(const void *buffer, int bufferLen, |
| 327 | const string &foreignAddress, unsigned short foreignPort) |
| 328 | throw(SocketException) { |
| 329 | sockaddr_in destAddr; |
| 330 | fillAddr(foreignAddress, foreignPort, destAddr); |
| 331 | |
| 332 | // Write out the whole buffer as a single message. |
| 333 | if (sendto(sockDesc, (raw_type *) buffer, bufferLen, 0, |
| 334 | (sockaddr *) &destAddr, sizeof(destAddr)) != bufferLen) { |
| 335 | throw SocketException("Send failed (sendto())", true); |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | int UDPSocket::recvFrom(void *buffer, int bufferLen, string &sourceAddress, |
| 340 | unsigned short &sourcePort) throw(SocketException) { |
no test coverage detected