Socket listening

Socket listening

Post by Amos Shapi » Wed, 29 Nov 1995 04:00:00

     A nit:  when the socket is created, it has the uid/gid of the process
   that created it stored in it's internals (see sock_alloc() in net/socket.c
   of your linux kernel).  When you accept() on a socket, you get a new
   socket also created with sock_alloc(), which should end up with whatever
   the current uid/gid happen to be at that moment.

     Someone always owns it.  It may not be who you'd like it to be, but
   someone unique always owns it.

     Your UID argument may be flawed, but your PID argument is not.

Thanks for the correction.

What I wonder is what do these uid/gid should mean?  Will they update
when the process changes uid/gid?  And what about two processes owned
by two different users who share the same socket (the situation I
described in my original article)?


--Amos Shapira                      | "Of course Australia was marked for
133 Shlomo Ben-Yosef st.            |  glory, for its people had been chosen
Jerusalem 93 805                    |  by the finest judges in England."


Socket listening

Post by Andreas Hammarsted » Fri, 01 Dec 1995 04:00:00

Two processes communicating with sockets have one socket each
and therefore have separate uid/gid, right?
And if I understand it correctly, even if you change uid/gid
on a process holding a socket, it doesn't change what that
socket is connected to (as logically, it wouldn't be any of
the peer process' business.)

Hope you didn't mind me slipping in on the proverbial banana
shell there. I might have missed a post or two on the subject.
                ._____/Andreas Hammarstedt\________.

                `. .'



1. How do I keep a socket listening while already handling connected clients??

Hi! I need some help/clarifications with the following:

I have my server setup a socket and wait for clients to connect on the
designated port. However, I want to be able to deal with mutiple clients.
The way I'm doing it right now is that I'm forking a child everytime a
connection is made. This APPEARS simple however introduces the problem of
dealing with mutual exclusions, etc. Is there a better way to implement


2. missing partition boot record when installing Solarisx86

3. Solaris 7 limit on socket listen queue

4. Installation problems with RH 5.1 on DEC Alpha

5. "ping" remote host to see if socket listening

6. Umlaute in sendmail

7. Why is unary negation test w/o arg, [ ! ], ok in sh, bash?

8. Socket listen fails with no error code

9. TCP socket listen queue

10. "ping" remote host to see if socket listening

11. hpux 11 - sockets - listen queue problem

12. raw sockets listening on Linux 2.2