i did a quick hack to fulfil my own needs, i post it here hopefully some one could benefit from it, and even get it merge into official code base.
modified these two lines in Network/ipaddress.hpp
IPAddress(const std::string& Address, Uint16 port = 0);
IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3, Uint16 port = 0);
and add these lines into Network/ipaddress.hpp
Uint16 getPort() const { return myPort; }
void setPort(Uint16 port) { myPort = port; }
...
private:
Uint16 myPort;
modified these lines in Network/ipaddress.cpp
IPAddress::IPAddress(const std::string& Address, Uint16 port) :
myPort(port)
{
...
}
IPAddress::IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3, Uint16 port) :
myPort(port)
{
...
}
add this line into Network/SocketUDP.cpp in method SocketUDP::Receive()
Address.setPort(htons(Sender.sin_port));
actually many things need to modified with this new changes, for example
bool SocketTCP::Connect(unsigned short Port, const IPAddress& HostAddress)
can be simplified to
bool SocketTCP::Connect(const IPAddress& HostAddress)
but since this is a quick hack, i leave it to you.