Add bindable argument.
This commit is contained in:
@@ -51,7 +51,7 @@ int32 NetworkBase::ReadSocket(NetworkSocket socket, byte* buffer, uint32 bufferS
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NetworkBase::CreateEndPoint(String* address, String* port, NetworkIPVersion ipv, NetworkEndPoint& endPoint)
|
bool NetworkBase::CreateEndPoint(String* address, String* port, NetworkIPVersion ipv, NetworkEndPoint& endPoint, bool bindable)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class FLAXENGINE_API NetworkBase
|
|||||||
static bool IsReadable(NetworkSocket& socket, uint64* size);
|
static bool IsReadable(NetworkSocket& socket, uint64* size);
|
||||||
static int32 WriteSocket(NetworkSocket socket, byte* data, uint32 length, NetworkEndPoint* endPoint = nullptr);
|
static int32 WriteSocket(NetworkSocket socket, byte* data, uint32 length, NetworkEndPoint* endPoint = nullptr);
|
||||||
static int32 ReadSocket(NetworkSocket socket, byte* buffer, uint32 bufferSize, NetworkEndPoint* endPoint = nullptr);
|
static int32 ReadSocket(NetworkSocket socket, byte* buffer, uint32 bufferSize, NetworkEndPoint* endPoint = nullptr);
|
||||||
static bool CreateEndPoint(String* address, String* port, NetworkIPVersion ipv, NetworkEndPoint& endPoint);
|
static bool CreateEndPoint(String* address, String* port, NetworkIPVersion ipv, NetworkEndPoint& endPoint, bool bindable = false);
|
||||||
static NetworkEndPoint RemapEndPointToIPv6(NetworkEndPoint& endPoint);
|
static NetworkEndPoint RemapEndPointToIPv6(NetworkEndPoint& endPoint);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ int32 Win32Network::ReadSocket(NetworkSocket socket, byte* buffer, uint32 buffer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if address is null, it's ADDR_ANY
|
// if address is null, it's ADDR_ANY
|
||||||
bool Win32Network::CreateEndPoint(String* address, String* port, NetworkIPVersion ipv, NetworkEndPoint& endPoint)
|
bool Win32Network::CreateEndPoint(String* address, String* port, NetworkIPVersion ipv, NetworkEndPoint& endPoint, bool bindable)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
addrinfoW hints;
|
addrinfoW hints;
|
||||||
@@ -303,8 +303,7 @@ bool Win32Network::CreateEndPoint(String* address, String* port, NetworkIPVersio
|
|||||||
hints.ai_family = ipv == NetworkIPVersion::IPv6 ? AF_INET6 : ipv == NetworkIPVersion::IPv4 ? AF_INET : AF_UNSPEC;
|
hints.ai_family = ipv == NetworkIPVersion::IPv6 ? AF_INET6 : ipv == NetworkIPVersion::IPv4 ? AF_INET : AF_UNSPEC;
|
||||||
hints.ai_flags |= AI_ADDRCONFIG;
|
hints.ai_flags |= AI_ADDRCONFIG;
|
||||||
hints.ai_flags |= AI_V4MAPPED;
|
hints.ai_flags |= AI_V4MAPPED;
|
||||||
if (paddr == nullptr)
|
if (bindable)
|
||||||
{
|
|
||||||
hints.ai_flags = AI_PASSIVE;
|
hints.ai_flags = AI_PASSIVE;
|
||||||
|
|
||||||
// consider using NUMERICHOST/NUMERICSERV if address is a valid Ipv4 or IPv6 so we can skip some look up ( potentially slow when resolving host names )
|
// consider using NUMERICHOST/NUMERICSERV if address is a valid Ipv4 or IPv6 so we can skip some look up ( potentially slow when resolving host names )
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public:
|
|||||||
static bool IsReadable(NetworkSocket& socket, uint64* size);
|
static bool IsReadable(NetworkSocket& socket, uint64* size);
|
||||||
static int32 WriteSocket(NetworkSocket socket, byte* data, uint32 length, NetworkEndPoint* endPoint = nullptr);
|
static int32 WriteSocket(NetworkSocket socket, byte* data, uint32 length, NetworkEndPoint* endPoint = nullptr);
|
||||||
static int32 ReadSocket(NetworkSocket socket, byte* buffer, uint32 bufferSize, NetworkEndPoint* endPoint = nullptr);
|
static int32 ReadSocket(NetworkSocket socket, byte* buffer, uint32 bufferSize, NetworkEndPoint* endPoint = nullptr);
|
||||||
static bool CreateEndPoint(String* address, String* port, NetworkIPVersion ipv, NetworkEndPoint& endPoint);
|
static bool CreateEndPoint(String* address, String* port, NetworkIPVersion ipv, NetworkEndPoint& endPoint, bool bindable = false);
|
||||||
static NetworkEndPoint RemapEndPointToIPv6(NetworkEndPoint endPoint);
|
static NetworkEndPoint RemapEndPointToIPv6(NetworkEndPoint endPoint);
|
||||||
friend NetworkEndPoint;
|
friend NetworkEndPoint;
|
||||||
friend NetworkSocket;
|
friend NetworkSocket;
|
||||||
|
|||||||
Reference in New Issue
Block a user