1. open a socket with some port on the server:
SOCKET sServerSocket;
SOCKADDR_IN sServerIn;
memset(&sServer In,0,sizeof(sSe rverIn));
sServerIn.sin_f amily=AF_INET;
sServerIn.sin_p ort=htons(hPort Number);
sServerIn.sin_a ddr.s_addr=hton l(INADDR_ANY);
//open server-side socket
sServerIn=socke t(AF_INET,SOCK_ STREAM,0);
bind(sServerSoc ket,(LPSOCKADDR )&sServerIn,siz eof(sServerIn))
2. declare an array of client sockets, and loop through the array, for each
client socket:
SOCKET sClientSocket[nCount];
SOCKADDR sClientSocketAd dress[nCount]
for (int i=0; i<nCount; i++)
{
sClientSocket[i]=accept(sServer Socket, &sClientSocketA ddress[i],
&nLength);
};
3. Now you should be able to connect to multiple clients.
J.W.
"Alisa" <al***********@ hotmail-dot-com.no-spam.invalid> wrote in message
news:40******** **@127.0.0.1...
Please help me, I have to make socket connection between server and
more than one client on some port. Is it possibly? I make socket
between server and one client, but more then one is problem. I know
that I have to put connected clients in some arraylist but how to
accept them, and how to communicate ith them. Sorry on my English.
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000
Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---