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)
ip = inet_ntoa(*ia);
}
+ this->IP = ip;
+
timeout_end = time(NULL)+maxtime;
timeout = false;
if ((this->fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
}
}
+std::string InspSocket::GetIP()
+{
+ return this->IP;
+}
+
char* InspSocket::Read()
{
int n = recv(this->fd,this->ibuf,sizeof(this->ibuf),0);
if (n > 0)
{
+ ibuf[n] = 0;
return ibuf;
}
else