Client/Server using Sockets??
Iqbal Khan
ikhan at mentor.com
Tue Jan 1 05:45:21 AEST 1991
I am using unix sockets for a client server modem. On the server side
I am using 'listen' and 'accept' for connections and on the client
side I am using 'connect'.
My problem is that I want to allow only one connection at a time. This
means that if the server has accepted a connection, all other
connections should be refused, instead of being put in the queue. I
have tried using 'backlog' of 0 in the 'listen' command but it did not
solve the problem. Here are a few lines on the server side:
/****************************************************************/
if (listen(sock,0) < 0) { /* backlog is zero */
perror("listening for connections");
close(sock);
exit(1);
}
...
msgsock = accept(sock,(struct sockaddr *) &addr,&len);
/****************************************************************/
I would appreciate any suggestions. Please send e-mail to
'ikhan at mentor.com' or 'khan at iuvax.cs.indiana.edu'.
Thanks in advance.
Iqbal Mustafa Khan
503-626-7000 (x7256)
P.S. My platform is apollo and O.S. verison 10.3.
--
Iqbal Mustafa Khan
More information about the Comp.unix.questions
mailing list