Explicitly set htons to 0
Also fix a typo.
This commit is contained in:
parent
4efe081084
commit
f0e73cf81b
1 changed files with 2 additions and 2 deletions
|
@ -57,7 +57,7 @@ void CSocket::Init ( const quint16 iPortNumber )
|
||||||
if (iPortNumber == 0)
|
if (iPortNumber == 0)
|
||||||
{
|
{
|
||||||
// If port number is 0, bind the client to a random available port.
|
// If port number is 0, bind the client to a random available port.
|
||||||
UdpSocketInAddr.sin_port = htons ( iPortNumber );
|
UdpSocketInAddr.sin_port = htons ( 0 );
|
||||||
|
|
||||||
bSuccess = ( ::bind ( UdpSocket ,
|
bSuccess = ( ::bind ( UdpSocket ,
|
||||||
(sockaddr*) &UdpSocketInAddr,
|
(sockaddr*) &UdpSocketInAddr,
|
||||||
|
@ -88,7 +88,7 @@ void CSocket::Init ( const quint16 iPortNumber )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// for the server, only try the given port number and do not try out
|
// for the server, only try the given port number and do not try out
|
||||||
// other port numbers to bind since it is imporatant that the server
|
// other port numbers to bind since it is important that the server
|
||||||
// gets the desired port number
|
// gets the desired port number
|
||||||
UdpSocketInAddr.sin_port = htons ( iPortNumber );
|
UdpSocketInAddr.sin_port = htons ( iPortNumber );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue