Programming Networks Assignment I
adapted from assignment made a Mississippi State University
Department of Computer Science CS4153/CS6153 - Fall 2000
-
Write a TCP client program in C or C++ on either UNIX or Win32 system that
queries the TCP daytime service (port 13) on a user-specified remote host.
The program must have the following features:
-
The user must be able to specify the remote host's address in the form
of its name or dotted IP address from the command line (both are valid
forms of addressing).
-
The client program must output the local host's name.
-
The client program must output the local socket's port number after the
connection with the remote host is established.
-
The client program must output the remote host's name/address (as specified
by the user) and the daytime data returned by the server.
-
Write a UDP client program in C or C++ on either UNIX or Win32 system that
queries the UDP daytime service (port 13) on a user-specified remote host.
The program must have the following features:
-
The user must be able to specify the remote host's address in the form
of its name or dotted IP address from the command line (both are valid
forms of addressing).
-
The client program must output the local host's name.
-
The client program must output the local socket's port number after the
remote host is first contacted.
-
The client program must output the remote host's name/address (as specified
by the user) and the daytime data returned by the server.
Your programs should check for errors at all critical points (memory
allocation, file and socket I/O calls, etc.).
Submission:
Turn in the two source files as attachments in an email to your instructor.
In class, turn in the printout of the outputs from at least four sample
runs of each program. At least two of the runs from each program must be
from servers in another time zone Email the output to me as an attachment
also. You may need to observe the example programs noted below . I have
included a link to a brief socket tutorial if this is not adequate, then
search for one on the "web" . There are numerous ones. Some more detailed
than others.
Sockets
example program 1 in C (TCP), example
program 2 in C (UDP), example program
1 in C++ (TCP), example program
2 in C++ (UDP), example socket programs
in C