Fixed an issue where the recvaddr was not set on Windows

- Also improved logging in UDPSocket
 - Resolves nasa/XPlaneConnect#39
This commit is contained in:
Jason Watkins
2015-04-13 20:20:55 -07:00
parent 52bf998632
commit fe88204b57
2 changed files with 59 additions and 57 deletions

View File

@@ -35,34 +35,34 @@ namespace XPC
/// specified receive port.
///
/// \param recvPort The port on which this instance will receive data.
UDPSocket(std::uint16_t recvPort);
UDPSocket(std::uint16_t recvPort);
/// Closes the underlying socket for this instance.
~UDPSocket();
~UDPSocket();
/// Reads the specified number of bytes into the data buffer and stores
/// the remote endpoint.
///
/// \param buffer The array to copy the data into.
/// \param size The number of bytes to read.
/// \param buffer The array to copy the data into.
/// \param size The number of bytes to read.
/// \param remoteAddr When at least one byte is read, contains the address
/// of the remote host.
/// \returns The number of bytes read, or a negative number if
/// an error occurs.
int Read(std::uint8_t* buffer, int size, struct sockaddr* remoteAddr);
/// of the remote host.
/// \returns The number of bytes read, or a negative number if
/// an error occurs.
int Read(std::uint8_t* buffer, int size, sockaddr* remoteAddr);
/// Sends data to the specified remote endpoint.
///
/// \param data The data to be sent.
/// \param len The number of bytes to send.
/// \param data The data to be sent.
/// \param len The number of bytes to send.
/// \param remoteHost The hostname of the destination client.
/// \param remotePort The port of the destination client.
void SendTo(std::uint8_t* buffer, std::size_t len, std::string remoteHost, std::uint16_t remotePort);
/// Sends data to the specified remote endpoint.
///
/// \param data The data to be sent.
/// \param len The number of bytes to send.
/// \param data The data to be sent.
/// \param len The number of bytes to send.
/// \param remoteHost The hostname of the destination client.
/// \param remotePort The port of the destination client.
void UDPSocket::SendTo(std::uint8_t* buffer, std::size_t len, std::uint32_t remoteIP, std::uint16_t remotePort);