binding of sockets in 4.2BSD

Jordan K. Hubbard jordan at greipa.UUCP
Tue Apr 30 10:59:39 AEST 1985


I'm confused.

A little while ago I decided to write some code to test out sockets
(unix domain) in a psudeo client-server configuration.
I consulted the IPC primer and wrote some code that didn't work.
Ok, so after consulting some existing socket-type code I found that you
use sockaddr_un instead of just 'sockaddr' as claimed in the manual.
This worked and I was amused.
However, each time I ran the server it complained that the
socket name being bound was already in use. Sure, because the
socket 'file' (choke) was still there and had to be removed each
time by hand. Shouldn't the close or shutdown calls do this? Once
a socket has been 'bound' the binding sticks around forever?
I must be missing a drastic point here because in the documentation
for 'accept' it also makes a somewhat confusing statement:

	If the server wishes to find out who its client is, it may
	supply a buffer for the client socket's name.

Now is this only useful for the internet domain? Under the
unix domain it just returns the the name the server bound because
the client had to use the same name to talk to it. Sounds kind of
useless..

As an aside, the IPC primer seems to lack a few things in the way
of explanation though it's a heck of a lot better than nothing at all.
Can anyone steer me in the direction of more in-depth coverage of
this topic? Handy hints gratefully accepted!
---

			Jordan K. Hubbard
			@ Genstar Rental Electronics.
			Palo Alto, CA.
			{sun, decwrl, dual}!twg!greipa!jordan

         This CPU's dead!

		"Er, no it's not. It's just in a wait state (holds down
		 reset switch) Look! It just executed an instruction!"

		It did not! You cycled the power!

		"No I didn't! It's just pausing for I/O!"



More information about the Comp.unix mailing list