Jeffrey Hutzelman <[EMAIL PROTECTED]> writes:
> ... Very few user-mode programs talk to the
> fileserver directly, but those that do, like scout, always originate their
> requests from a fixed port.  This is because as shipped, Rx does not
> provide an interface that allows an Rx service to be started on a randomly
> assigned port. 

Actually, it *is* perfectly possible to write a userland program that
implements an rx service on a "randomly assigned port" (from
rx_Init(0)).  You just need a bit of code that looks something like
this:

        namelen = sizeof(sin);
        if (getsockname(rx_socket, (struct sockaddr *) &sin, &namelen) < 0)
        {
if (vflag)
printf ("rx_socket: %d\n", rx_socket);
                perror("getsockname");
                exit(1);
        }
        rx_port = sin.sin_port;

All this does is find out what port the kernel assigned to rx,
then tells rx what that port # is.

It's apparently also possible to start up a service on a port
other than the default RX port (using the first parameter to
rx_NewService) but I'm not sure how well this actually works. 
This isn't useful in talking to the fileserver, of course.

I think the only magic "client" port number the fileserver knows
about today is "ropcons 2115/udp".  I'm not sure anything in AFS today
actually uses that port - scout uses ports from 7101 counting up (yes,
there actually appears to be logic in scout to bump the port# up if
it's in use.)

                                -Marcus Watts
                                UM ITCS Umich Systems Group

Reply via email to