Nodes use network order for ports.
This commit is contained in:
parent
31ae9a779a
commit
c83fab449a
@ -15,11 +15,11 @@ namespace Components
|
|||||||
}
|
}
|
||||||
void Network::Address::SetPort(unsigned short port)
|
void Network::Address::SetPort(unsigned short port)
|
||||||
{
|
{
|
||||||
this->address.port = ntohs(port);
|
this->address.port = htons(port);
|
||||||
};
|
};
|
||||||
unsigned short Network::Address::GetPort()
|
unsigned short Network::Address::GetPort()
|
||||||
{
|
{
|
||||||
return htons(this->address.port);
|
return ntohs(this->address.port);
|
||||||
}
|
}
|
||||||
void Network::Address::SetIP(DWORD ip)
|
void Network::Address::SetIP(DWORD ip)
|
||||||
{
|
{
|
||||||
|
@ -60,7 +60,7 @@ namespace Components
|
|||||||
Network::Address address;
|
Network::Address address;
|
||||||
|
|
||||||
address.SetIP(this->ip);
|
address.SetIP(this->ip);
|
||||||
address.SetPort(this->port);
|
address.SetPort(ntohs(this->port));
|
||||||
address.SetType(Game::netadrtype_t::NA_IP);
|
address.SetType(Game::netadrtype_t::NA_IP);
|
||||||
|
|
||||||
return address;
|
return address;
|
||||||
@ -69,7 +69,7 @@ namespace Components
|
|||||||
void fromNetAddress(Network::Address address)
|
void fromNetAddress(Network::Address address)
|
||||||
{
|
{
|
||||||
this->ip = address.GetIP();
|
this->ip = address.GetIP();
|
||||||
this->port = address.GetPort();
|
this->port = htons(address.GetPort());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user