mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-29 05:17:59 +03:00
change ip
This commit is contained in:
@@ -12,7 +12,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Socket();
|
Socket();
|
||||||
Socket(int domain, int type, int protocol, int port);
|
Socket(int domain, int type, int protocol, int port, std::string ip);
|
||||||
int getSocketFd(void);
|
int getSocketFd(void);
|
||||||
struct sockaddr_in getAddres(void);
|
struct sockaddr_in getAddres(void);
|
||||||
socklen_t getAddlen(void);
|
socklen_t getAddlen(void);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Header::Header()
|
|||||||
{
|
{
|
||||||
this->_row = 0;
|
this->_row = 0;
|
||||||
this->_fd = -1;
|
this->_fd = -1;
|
||||||
this->_autoIndex = 0;
|
this->_autoIndex = 1;
|
||||||
initErrorCode();
|
initErrorCode();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ void Server::newConnection(int fd)
|
|||||||
|
|
||||||
void Server::start(void)
|
void Server::start(void)
|
||||||
{
|
{
|
||||||
Socket serverSocket(AF_INET, SOCK_STREAM, 0, _port);
|
Socket serverSocket(AF_INET, SOCK_STREAM, 0, _port, "127.0.0.1");
|
||||||
char buff[BUFFSIZE + 1] = {0};
|
char buff[BUFFSIZE + 1] = {0};
|
||||||
Header header;
|
Header header;
|
||||||
int fd_accept;
|
int fd_accept;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Socket::Socket()
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
Socket::Socket(int domain, int type, int protocol, int port)
|
Socket::Socket(int domain, int type, int protocol, int port, std::string ip)
|
||||||
{
|
{
|
||||||
int opt = 1;
|
int opt = 1;
|
||||||
_socketFd = socket(domain, type, protocol);
|
_socketFd = socket(domain, type, protocol);
|
||||||
@@ -13,7 +13,7 @@ Socket::Socket(int domain, int type, int protocol, int port)
|
|||||||
| SO_REUSEPORT, &opt, sizeof(opt)), "Set socket options");
|
| SO_REUSEPORT, &opt, sizeof(opt)), "Set socket options");
|
||||||
_addres.sin_family = domain;
|
_addres.sin_family = domain;
|
||||||
_addres.sin_port = htons(port);
|
_addres.sin_port = htons(port);
|
||||||
_addres.sin_addr.s_addr = INADDR_ANY;
|
_addres.sin_addr.s_addr = inet_addr(ip.c_str());
|
||||||
_addrlen = sizeof(_addres);
|
_addrlen = sizeof(_addres);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user