How to create an array of sockets for CSocket in MFC?

93 Views Asked by At

In Windows Sockets the following used to work fine. How can I achieve the same in Csocket class of MFC? Just replacing SOCKET with CSocket gives error on line 3 when compiled.

static SOCKET sArray[100];
SOCKET s;
sArray[count]=s;

Error:

error C2248: 'CSocket::operator =': cannot access private member declared in class 'CSocket'
1

There are 1 best solutions below

0
xMRi On

You are not allowed to copy a CSocket object. That's all what the message tells you. If you have an array, use the object in the array position count.