Client thread test version. Ready to connect.
This commit is contained in:
@@ -22,6 +22,27 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool
|
||||
socket_set_port(unsigned port, int addrFamily, struct sockaddr *addr, int addrLen)
|
||||
{
|
||||
bool retVal = false;
|
||||
|
||||
if (addr)
|
||||
{
|
||||
if (addrFamily == AF_INET && addrLen >= sizeof(sockaddr_in))
|
||||
{
|
||||
((sockaddr_in *)&addr)->sin_port = htons(port);
|
||||
retVal = true;
|
||||
}
|
||||
else if (addrFamily == AF_INET6 && addrLen >= sizeof(sockaddr_in6))
|
||||
{
|
||||
((sockaddr_in6 *)&addr)->sin6_port = htons(port);
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
bool
|
||||
internal_socket_resolve(const char *str, const char *port, int addrFamily, int sockType, int protocol, struct sockaddr *addr, int addrLen)
|
||||
|
||||
Reference in New Issue
Block a user