TCP IP Illustrated

12 from sun to bsdi echoes everything we type sun

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: king protocols, and not network programming, in this Appendix we only describe the program and its various options. There are numerous other programs with functionality similar to sock. Juergen Nickelsen wrote a program named socket and Dave Yost wrote a program named sockio. Both contain many similar features. Pieces of the sock program have also been inspired by the public domain ttcp program, written by Mike Muuss and Terry Slattery. The sock program operates in one of four modes: 1. Interactive client: the default. The program connects to a server and then copies standard input to the server and copies everything received from the server to standard output. This is shown in Figure C.1. Figure C.1 Default operation of sock as interactive client. We must specify the name of the server host and the name of the service to connect to. The host can also be specified as a dotted-decimal number, and the service can be specified as an integer port number. Connecting to the standard echo server (Section 1.12), from sun to bsdi echoes everything we type: sun % sock bsdi echo a test line a test line ^D we type this line and the echo server returns a copy type our end-of-file character to terminate 2. Interactive server: the -s option is specified. The service name (or port number) is required: sun % sock -s 5555 act as server listening on port 5555 file:///D|/Documents%20and%20Settings/bigini/Docu...homenet2run/tcpip/tcp-ip-illustrated/append_c.htm (1 of 4) [12/09/2001 14.48.01] Appendix C: The sock Program The program waits for a connection from a client and then copies standard input to the client and copies everything received from the client to standard output. An Internet address can precede the port number on the command line, to specify on which local interface connections are accepted: sun % sock -s 140.252.13.33 5555 accept connections only on Ethernet The default mode is to accept a connection request on any local interface. 3. Source client: the -i option is specified. By default a 1024-byte buffer...
View Full Document

Ask a homework question - tutors are online