ServerCore/IPAddress.h
2024-07-10 13:30:18 -07:00

31 lines
706 B
C++

#ifndef __IPAddress_h__
#define __IPAddress_h__
#include <sys/socket.h>
#include <netinet/in.h>
#include <string>
namespace core {
class IPAddress {
public:
IPAddress();
IPAddress(std::string address);
IPAddress(std::string address, int port);
~IPAddress();
struct sockaddr_in addr;
socklen_t addressLength;
struct sockaddr * getPointer();
std::string getClientAddress(); ///<Get the client network address as xxx.xxx.xxx.xxx.
std::string getClientAddressAndPort(); ///<Get the client network address and port as xxx.xxx.xxx.xxx:ppppp.
int getClientPort(); ///<Get the client network port number.
};
}
#endif