15. TCP/IP apps

TCP/IP has several standard apps, such as telnet, ftp, ...

15.1 telnet
15.2 ftp src.doc.ic.ac.uk
15.3 mc ftp://src.doc.ic.ac.uk/packages/linux/sunsite.unc-mirror
15.4 netscape ftp://src.doc.ic.ac.uk/packages/linux/sunsite.unc-mirror
15.5 98% of 3344 K (Stalled)
15.6 restart 3287040
15.7 sendmail
15.8 NFS
15.9 ident
15.10 http

15.1

telnet

Telnet gives you a tty connection to a remote host, where you get the login prompt.

It isn't a VDU emulator, you want to set the same TERM on the remote host as is infront of you. The remote host must have the correct terminfo configuration!

Telnet has two modes, key-by-key, and line buffer mode. This is like the kernel, and usually gets switched at the correct time, to the correct mode.

Telnet adds a CRTL-] key, to interrupt and then quit the connection.

telnet host port

Telnet can also connect to any remote port, (even if it doesn't make sense to do so). This enables you to manually drive a network connection that is ususally automated.

For example as a substitute for sendmail, you can connect to a remote smtp server using:

telnet remote smtp
but then you will be talking to the remote hosts SMTP daemon (sendmail), and you will have to talk it's language.

15.2

ftp src.doc.ic.ac.uk

ftp is how you connect to a remote machine and transfer files.

Most servers allow you to connect as the user 'anonymous' with password: user@host.domain or password: user@

If you select anonymous login, you get access to a sub-zone of the remote machine. If you connect as an actual user (with the actual password), you get access to the full machine (at least those files that that user can read or write).

A common feature of anonymous ftp, is that access is limited to files within /home/ftp. Your system is probably already configured as an anonymous server. You can see what you look like with ftp localhost (not much fun, as there aren't any interesting files in /home/ftp).

Once you have done an ftp connect/login, you have a command line interface where you can type simple commands. The actual transfers use a second connection.

 /.netrc

To automate the login process, you can create $HOME/.netrc,

www.users.dircon.co.uk  login trix 
beyond.malmo.lth.se  login gps
default login anonymous password gps@ 
ftp -n remote, will not read .netrc

cd /packages/linux

some ftp commands look (a bit) like unix commands. lcd does a local cd

ls -rt

This lists the files in reverse time order. You can also specify a wild-card which makes slow connections usable.

binary

This tells ftp to request binary mode transfers for all files. Most servers do this anyway, but if you forget, the .tgz file will contain errors.

hash

This command is VITAL. It tells ftp to print a '#' for every 1K transfered. It tells you that ftp and TCP/IP are alive and making progress,

get README.NOW

This fetches the remote file to the current directory. The file's date will be set to today (mc corrects for this if it can).

mget pkg*26*

This is a multi-get (even if only one file matches!), every matching filename will be offered, and you reply 'y'.

The wildcard you use may pick up files you don't want (such as pkg-0.7.26-a.out.tgz), so you say 'n'.

ftp runs at about 0.5 to 5 Kps over V34 modem. Binaries usually transfer at line speed, ie 2.5 Kps. A 4 megabyte file takes half an hour -if- everything runs quickly. Throughput depends on every component in the chain.

15.3

mc ftp://src.doc.ic.ac.uk/packages/linux/sunsite.unc-mirror

mc, mosaic, netscape and others make excellent ftp browsers.

mc version 3 has ftp browsing added (with a similar syntax). If you setup $HOME/.netrc it will know to login as anonymous. It also keeps fetched files (eg after pressing the F3 key) so that a subsequent F5-COPY is quick. It has a few bugs, but I guess the authors know that.

15.4

netscape ftp://src.doc.ic.ac.uk/packages/linux/sunsite.unc-mirror

Netscape can make a remote ftp site, as convenient as a WEB site, (and vice verse). Ususally, netscape known when to display a file, and when to download it to disk, but pressing SHIFT when clicking on a URL may help.

15.5

98% of 3344 K (Stalled)

Nightmare! If your sessions stalls, eg the remote host goes off-line, you have 15 minutes to do something, before Netscape gives up. DO NOT PRESS STOP.

If you press STOP, or if Netscape decides to stop, the dialog box will be removed from the screen, and the file (98% there) will be deleted from the disk. Instead, try the following:

cd ~/9607/0731	# netscape is saving the file here
mkdir bad
cd bad
ls ..
ln ../big_file.tgz .

Then when Netscape deletes the file, it will only unlink the name it created, the second link will still be there, with the 98% still in it.

15.6

restart 3287040

Now the remote host comes back, or you find the EXACT SAME file on a different server (it must be an FTP server, not a WWW server).

ls -l big_file.tgz	# write down the number of bytes 3287040
ftp remote host
binary
hash
cd wherever
ls			# ie as usual

restart 3287040
get big_file.tgz
FTP will now start a new transfer, but add it to the existing file, and restarting at the 3287040 byte point. Which is what you want.

15.7

sendmail

Sendmail implements SMTP for incoming email, and outgoing also.

To configure it, see the sendmail section. To use it, install PINE or ELM (or an X11 mail-user-agent MUA of your choice).

15.8

NFS

Network file system, is how one unix box exports it's files to another unix box (or a box that implements the NFS protocol).

It is mostly configured with /etc/exports, but both servers must have the correct daemons running.

15.9

ident

You don't run this manually, but when you contact a remote host, it will usually call you back, and ask your machine who you are, using the ident protocol.

This usually just confirms who you logged in as, using the TCP/IP stream that you connected with as the selector.

DOS machines may return the name "unknown", as they don't have a login system or username. Similarly proxy hosts may return equally vague informations.

ident can lie, it is after all a program running on your machine, you can substitute and code there. However it is very useful when the host machine isn't a personal workstation, but a well administered server. rcp uses identp to help identify the caller.

If you run a web-server, you can log the identity of every calling user. You will see that many callers are "unknown" or "-", which suggests that they are calling from DOS boxes, or proxy machines.

This makes it very easy to then call up "talk", and have a chat with whoever is calling your machine, or not if it is "unknown".

15.10

http

"hyper-text-transfer-protocol" is the protocol used by web servers, to transfer control information, text files, binary files and .html files. It is usually associated with port-80.