Re: Working over TCP


Subject: Re: Working over TCP
From: Sak Wathanasin (sw@nan.co.uk)
Date: Fri Jan 05 2001 - 10:37:54 EST


In reply to Duncan Sinclair's message of the 05/01/2001 at 15:18 +0000,

>This seems to be a new urban myth. My Sun appears as "Department Server"
>in my Chooser. I don't even think it would be possible to put this name
>in the DNS. But TCP connections work OK for me.
>
>I believe the Mac gets the IP number from the server either in the original
>NBP (Chooser) information, or through an initial appletalk-based meeting of
>minds. I think it's the second one...
>
>There may well be factors concerning what IP number your server thinks
>it has, compared with what the client thinks it is. For example, if
>you have more than one IP number, perhaps if the server uses the wrong
>one, the client will not be able to initialise a TCP connection and
>fall back to AppleTalk. (As afp over tcp always worked for me, I not
>an expert on the possible ways it can fail.)

When you click on the server in the Chooser, the Mac sends an
FPGetSrvrInfo request to the server. In the reply, the server sends
its hostname, the versions of AFP that it supports, the UAMs that it
supports, etc etc and right at the end, it sends the addresses it can
be contacted on.

You can get the details from .../etc/afpd/status.c; the routine
status_netaddress has the following comment:

     /* format:
        Address count (byte)
        len (byte = sizeof(length + address type + address)
        address type (byte, ip address = 0x01, ip + port = 0x02,
                            ddp address = 0x03, fqdn = 0x04)
        address (up to 254 bytes, ip = 4, ip + port = 6, ddp = 4)
        */

I.e., it sends a count of the different ways it can be contacted, and
for each of them it sends the type (AppleTalk, IP addr or name) and
then the respective address or name. It's up to the client what it
does with this info: AppleShare tries the TCP connection(s?) first,
then the AppleTalk ones.

If the client is given an incorrect IP addr, the attempt to talk to
ASIP will fail. netatalk obtains this addr using the std
gethostbyname() call, and this will use DNS, NIS or /etc/hosts
depending on your nsswitch.conf settings. It uses not the server name
(which can be changed in the afpd.conf file) but the hostname of the
server (as returned by the "hostname" or "uname -n" cmd) to obtain
its IP addr.

-- 
Sak Wathanasin
Network Analysis Limited
178 Wainbody Ave South, Coventry CV3 6BX, UK

Internet: sw@nan.co.uk Phone: (+44) 24 76 41 99 96 Mobile: (+44) 79 70 75 19 12 Fax: (+44) 24 76 69 06 90



This archive was generated by hypermail 2b28 : Sun Oct 14 2001 - 03:04:30 EDT