[comp.unix.questions] Socket stuff

pcb@gator.cacs.usl.edu (Peter C. Bahrs) (02/20/90)

First, does anyone have a reference to a comprehensive text or TR dealing
with sockets (socket, bind, connect, accept, read, ERRORS) besides
the two standard UNIX Tutorials on IPC (sorry, I forgot the authors).

If not, how about somebody put together a good ipc TR that uses all of
the features via source code examples (something that looks more legible
than our rwho.c code).

Second, I have a question about connect and listen.  I tell listen (..5).
If the queue is 5 and a request comes in exactly what is 'disgarded'?
Does this also imply that a client should 'loop' on a connect if ETIMEOUT
is returned and the client must get through?


/*----------- Thanks in advance... --------------------------------------+
| Peter C. Bahrs                                                         |
| The USL-NASA Project                                                   |
| Center For Advanced Computer Studies   INET  pcb@gator.cacs.sl.edu     |
| University of Southwestern Louisiana   ...!uunet!dalsqnt!gator!pcb     |
| Lafayette, LA 70504                                                    |
+-----------------------------------------------------------------------*/

bugboy@portia.Stanford.EDU (Michael Frank) (02/24/90)

Peter C. Barhs says:
>First, does anyone have a reference to a comprehensive text or TR dealing
>with sockets (socket, bind, connect, accept, read, ERRORS) besides
>the two standard UNIX Tutorials on IPC (sorry, I forgot the authors).
>
>If not, how about somebody put together a good ipc TR that uses all of
>the features via source code examples (something that looks more legible
>than our rwho.c code).

I, too, would like a reference to the text, and good example source
code for ipc.  I'm trying to create a server-client system.  It's on a
SPARCstation, so I could use RPC, but sockets seem (?) more portable and
more flexible.

What I want to do, specifically, is this: I want my client processes
to be able to find the server easily (at least on the host machine),
and send various messages to it, and receive messages back (but not
neccessarily in a 1:1 correspondence to the messages sent, as RPC
seems to assume).  I want the clients to be able to send and receive
messages either with or without blocking, so that each client may have
whatever kind of dynamics are appropriate to it.  I want the clients
to be able to time out on a blocked send or receive if they want to.
And I want the server to queue up the messages from all the clients
and handle them one at a time, and send messages back to various clients
in response.  The server should never block on a message send.  And if
a client dies, the server shouldn't break.

Maybe it's in the manuals, but it's too much to swallow all at once
without some good examples.  Sockets are extraordinarily complex.

Anyway, thanks for any help.

Mike Frank

arleneh@puffin.uss.tek.com (02/27/90)

For a comprehensive book on network programming including sockets, try:

UNIX NETWORK PROGRAMMING  by W. Richard Stevens
Prentice Hall, 1990, ISBN 0-13-949876-1

This book covers IPC and sockets for both Berkeley and System V
models, with many client-server examples in the text, the code for
which is available on UUNET.

Hope this helps.

Arlene
--
Arlene D. Hills, Tektronix			Unix Systems Support
PO Box 500, MS 50-453, Beaverton, OR 97077	Tektronix Network Services
arleneh@puffin.USS.TEK.COM  (503) 627-5417	Telecommunications Group