|
|
|
talknet is a program that allows you to interactively establish and communicate over a network connection. A network connection is usually structured according to the client-server model. A server program listens at an assigned network port for connection requests from client programs. The client program "calls" the server program at the server's network port (basically, its telephone number). When the server "answers" the call, it accepts the connection request and begins talking to the client over the network connection.
Client <----------> Server (calls) (answers)
The network port at which the server listens is assigned in the
/etc/services
file (on UNIX systems, at least). The
information for a particular server should be available and consistent on
both the client's computer and the server's computer. Sample entries in
the services file for the netecho program look as follows:
netecho 2402/tcp netsink 2403/tcp
The netecho program listens at either of two ports depending on the mode it's in (data echo or data sink). UNIX provides the server name/port number mapping facility; on other systems, you might need to reference the port number directly (talknet allows you to do that, too).
talknet can function in either of two modes: as a client or as a server. If the program you want to talk to over the network is a server program, bring talknet up in client mode (its default). talknet will contact the server, establish a network connection with it, and then let you talk to the server. Anything you type in at the keyboard is transmitted to the server; anything the server sends back over the network is displayed on your screen.
If the program you want to talk to over the network is a client program,
talknet can be brought up in server mode (with the
"-server
" command line option). In this case, talknet
listens at the network port, waiting for a connection request from the
client program. When a call comes in, talknet answers it,
establishes the connection with the client, and then lets you talk to the
client.
talknet has a lot of command line options, but you can ignore most of them. The most common invocation is:
% talknet -hex server
(%
is the UNIX C Shell prompt.) This command tells
talknet to contact the specified server on your own machine; all
data received from the server is displayed on your screen in a combined
hexadecimal and ASCII dump ("-hex
" for hexadecimal/ASCII
dump). If the server is on another machine, simply specify the remote
host's name:
% talknet -hex server[@host]
If the program you're talking to expects XDR strings (Sun's eXternal
Data Representation protocol), also specify the "-xdr
"
option:
% talknet -hex -xdr server[@host]
To run talknet as a server, add the "-server
" option;
no host name is required or allowed:
% talknet -hex -server server
To terminate talknet, just type ^C
(control-C).
Note: If no format option ("-decimal
", "-octal
", or "-hexadecimal
") is specified, the data input from the server is simply written (with EBCDIC-ASCII conversion if requested) to the user's terminal.
% talknet [-debug] [-decimal] [-hexadecimal] [-listen] [-octal] [-text] [-udp] [-xdr] server[@host]
where
-debug
- enables debug output (written to stdout).
-decimal
- dumps each byte as a decimal number.
-hexadecimal
- dumps every 4 bytes as a hexadecimal number.
-listen
- puts talknet in server mode, i.e., rather than talking to a server, talknet talks to a client - talknet is the server. talknet listens for a connection request from a client, answers it, and then carries on a conversation with the client, just like it (talknet) normally does with a server.
-octal
- dumps each bye as an octal number.
-text
- dumps each byte as text, i.e., the data is not dumped in numeric form.
-udp
- specifies that a UDP/IP network connection is to be established. The default is to establish a TCP/IP connection.
-xdr
- sets XDR mode. In this mode, a line of data typed in by the user is output on the network as an XDR counted byte string embedded in an RPC record.
server[@host]
- specifies the server (by name or by port number) and, optionally, the name of the host on which the server is running. If a server name is specified, it should be present in the local host's
/etc/services
system file. If no host is specified, the local host is assumed.