[net.bugs.4bsd] reposting: sockets problem

aoki@trwspp.UUCP (06/06/84)

[are you hungry?????]

Here a problem for all you 4.2 wizards :::::

	The problem is this.  We have been playing with sockets, and
    have been experiencing very slow response time.

	(taking the code from the IPC Primer)
	When a single link to the server was created, communications
    seems to work properly.  However, when multiple links were made to
    the server (4 to be exact), after several iterations of send and
    receive between server and clients, the client seems to hang.  We
    only think that the problem is in the client, we're not sure.

	Include here a portion of the code:
	
	int	sd;
	int	nsd1, nsd2, nsd3, nsd4;
	struct	sockaddr_in 	from;
	char	msg[100],
		ack[100];

	listen(sd, 4);
	
	nsd1 = accept(sd, &from, &len);
	nsd2 = accept(sd, &from, &len);
	nsd3 = accept(sd, &from, &len);
	nsd4 = accept(sd, &from, &len);
	.
	.
	.
	while (1) {
		cntr = recv(nsd1, msg, sizeof(msg), 0);
		if (cntr != ERROR) {
			cntr = send(nsd1, ack, sizeof(ack), 0);
		}
		.
		.(repeated for other links)
		.
	}
	
--------------------

	Any experiences with sockets you would like to share with me
    would be greatly appreciated.  (any other experiences with
    sockets other than the problem mentioned would also appreciated)

	Before you say it, I have been reading net.unix-wizards.

	As they say, thanks in advance...

			::::: Dean K. Aoki :::::

			UUCP:  { ucbvax | decvax } !trwrb!trwspp!aoki
			ARPA:  !trwrb!trwspp!aoki@BERKELEY
			USPS:  T R W  Defense Systems Group
			       One Space Park  MS:  119-2142F
			       Redondo Beach, CA  90278