Added = operator
This commit is contained in:
@@ -389,6 +389,33 @@ ostream& operator<<(ostream &os, EzSockets &obj)
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EzSockets& EzSockets::operator=(const EzSockets &socket)
|
||||||
|
{
|
||||||
|
if (this == &socket) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
blocking = socket.blocking;
|
||||||
|
fromAddr = socket.fromAddr;
|
||||||
|
fromAddr_len = socket.fromAddr_len;
|
||||||
|
string inBuffer = socket.inBuffer;
|
||||||
|
outBuffer = socket.outBuffer;
|
||||||
|
state = socket.state;
|
||||||
|
lastCode = socket.lastCode; //Used for debugging purposes
|
||||||
|
MAXCON = socket.MAXCON;
|
||||||
|
sock = socket.sock;
|
||||||
|
addr = socket.addr;
|
||||||
|
if (scks == NULL)
|
||||||
|
scks = new fd_set;
|
||||||
|
*scks = *socket.scks;
|
||||||
|
if (scks == NULL)
|
||||||
|
times = new timeval;
|
||||||
|
*times = *socket.times;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************\
|
/**************************\
|
||||||
| Internal Data System |
|
| Internal Data System |
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ public:
|
|||||||
char operator[] (int i); //Access buffer
|
char operator[] (int i); //Access buffer
|
||||||
friend istream& operator>>(istream& is, EzSockets& obj);
|
friend istream& operator>>(istream& is, EzSockets& obj);
|
||||||
friend ostream& operator<<(ostream& os, const EzSockets& obj);
|
friend ostream& operator<<(ostream& os, const EzSockets& obj);
|
||||||
|
EzSockets& operator=(const EzSockets &socket);
|
||||||
|
|
||||||
|
|
||||||
bool blocking;
|
bool blocking;
|
||||||
|
|||||||
Reference in New Issue
Block a user