jordan@greipa.UUCP (Jordan K. Hubbard) (04/30/85)
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!"
keith@reed.UUCP (Keith Packard) (05/12/85)
In article <177@greipa.UUCP> jordan@greipa.UUCP (Jordan K. Hubbard) writes: > > 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.. Actually, this is still useful, even in unix domain. This is because sockets are I-nodes. So, you can link upto 32767 different names to the same socket. I found this very useful for a window manager I wrote for my tektronix 4105 terminal. It's main job was to sit in the background reading from sockets and displaying stuff all over the screen. Now, when time came to connect to another window (socket) I thought I would have to accept connections on another socket so that I could tell which window (socket) had been selected. But, the socket code does all of this for me by passing the name used to connect to the socket back to me. This was just great! I now have the window manager accepting connections on one socket and, when connection is made, reading input on the socket created upon connection. And, all of these windows have ascii names - I ended up putting these names into a cute little box at the top of the window; that way I know whats going on. > > > Jordan K. Hubbard > @ Genstar Rental Electronics. > Palo Alto, CA. > {sun, decwrl, dual}!twg!greipa!jordan > Keith Packard ...!tektronix!azure!keithp (work) ...!tektronix!reed!motel6!keithp (home) "Sorry, no cute ending - we ran out of funding at the last moment"