#include <rludpsocket.h>
class for encapsulating ip addresses
Definition at line 40 of file rludpsocket.h.
int rlIpAdr::operator== |
( |
rlIpAdr & |
address1 | ) |
|
int rlIpAdr::setAdr |
( |
const char * |
adr, |
|
|
int |
port |
|
) |
| |
Definition at line 31 of file rludpsocket.cpp.
{
if(port < 0 || port >= 256*256) return -1;
struct in_addr IpAddress;
struct hostent *host;
memset(&IpAddress,0,sizeof(IpAddress));
host = gethostbyname(adr);
if(host == NULL)
{
IpAddress.s_addr = inet_addr(adr);
if(IpAddress.s_addr == INADDR_NONE)
{
::printf("rlIpAdr::setAdr() could not gethostbyname(%s)\n",adr);
return -1;
}
}
else
{
memcpy(&IpAddress,host->h_addr,host->h_length);
}
address.sin_port = htons((
short) port);
return 0;
}
struct sockaddr_in rlIpAdr::address |
The documentation for this class was generated from the following files: