]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socket.cpp
EXPERIMENTAL new socket engine code
[user/henk/code/inspircd.git] / src / socket.cpp
index 67ff65c7066eabec664282822a58b0644a7e8249..36b6d1d1e52d1793e3e087e719f5bece70e31a44 100644 (file)
@@ -48,10 +48,11 @@ InspSocket::InspSocket()
        this->state = I_DISCONNECTED;
 }
 
-InspSocket::InspSocket(int newfd)
+InspSocket::InspSocket(int newfd, char* ip)
 {
        this->fd = newfd;
        this->state = I_CONNECTED;
+       this->IP = ip;
 }
 
 InspSocket::InspSocket(std::string host, int port, bool listening, unsigned long maxtime)
@@ -94,6 +95,8 @@ InspSocket::InspSocket(std::string host, int port, bool listening, unsigned long
                        ip = inet_ntoa(*ia);
                }
 
+               this->IP = ip;
+
                 timeout_end = time(NULL)+maxtime;
                 timeout = false;
                 if ((this->fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
@@ -138,6 +141,11 @@ void InspSocket::Close()
        }
 }
 
+std::string InspSocket::GetIP()
+{
+       return this->IP;
+}
+
 char* InspSocket::Read()
 {
        int n = recv(this->fd,this->ibuf,sizeof(this->ibuf),0);