Simple TCP/IP time client

This program demonstrates a simple TCP/IP client. It will connect to a time server and display the current time.

Programming Issues

This program illustrates the classic process for a TCP/IP client program. Summarised, it is as follows:

Usage

Launch a server process in the background (or find one already running) and run the program to connect to it:

[paul@localhost paul]$ ./timeserv 3357 &
[paul@localhost paul]$ ./timeclnt -a 127.0.0.1 -p 3357
The current time is: Sat Oct 16 19:26:17 1999

[paul@localhost paul]$

Use the -a and -p switches to specify the remote IP address and port of the server.

Source and Downloads