| 73 | } |
| 74 | |
| 75 | Util::MemoryFrame UDPSocket::receivePacket(UDPAddr &target, Util::MemoryFrame dest) |
| 76 | { |
| 77 | //int targetSize = sizeof(target); |
| 78 | _state = 0; |
| 79 | int fromlen = sizeof(sockaddr); |
| 80 | int byteCount = ::recvfrom(_s, (char*)dest.begin(), dest.size(), NULL, (sockaddr*)&target, &fromlen); |
| 81 | if(byteCount == SOCKET_ERROR) |
| 82 | { |
| 83 | _state = WSAGetLastError(); |
| 84 | if( _state == WSAEWOULDBLOCK |
| 85 | ||_state == WSAECONNRESET) |
| 86 | return Util::MemoryFrame(); |
| 87 | throw GeneralException("::recv failed"); |
| 88 | } |
| 89 | return dest.getSubFrame(0, byteCount); |
| 90 | } |
| 91 | |
| 92 | int UDPSocket::getNextPacketSize() |
| 93 | { |
no test coverage detected