The assignment (and a few lab exercises) for this course are based on network programming. You are given the choice to use either Python, JAVA or C for attempting the assignment and the programming based lab exercises. Decide on which programming language you would use (the one you are most comfortable/proficient with) and practice writing simple network based programs.
We have provided sample TCP and UDP client and server programs written in Python, JAVA and C that you can download and execute (see links at the bottom). This will provide you with a working example of a simple application and will be useful when you start developing your assignment. This is an ECHO program, in which the server echoes back the data, after converting it to Uppercase (i.e. capital letters) to the client. Compile and run these programs in different xterm windows on the same host.
NOTE: please read the programs before executing them to understand what they do.
C Programs
Usage after compiling and assuming that the executables are named TCPServer and TCPClient respectively (for UDP the executables are UDPServer and UDPClient). Execute them in different xterm windows on the same host:
>TCPServer
>TCPClient
Once the client is running it will ask for user input. Type a string in lower case. The client should print the corresponding upper case string received from the server.
If you encounter an error message that the port is already in
use, change the server port number in both client and server
programs (it is currently 1500), someone else may be running the
same program at that time. Look for a comment that says //change
this port number if required
Java Programs
Usage after compiling and assuming that the executables are named TCPServer and TCPClient respectively (for UDP the executables are UDPServer and UDPClient). Execute them in different xterm windows on the same host:
>java TCPServer
>java TCPClient
Once the client is running it will ask for user input. Type a string in lower case. The client should print the corresponding upper case string received from the server.
If you encounter an error message that the port is already in
use, change the server port number in both client and server
programs (it is currently 6789), someone else may be running the
same program at that time. Look for a comment that says /*change
above port number if required*/ to make this change.
Python Programs
Usage assuming that the executables are named TCPServer and TCPClient respectively (for UDP the executables are UDPServer and UDPClient). Execute them in different xterm windows on the same host:
>python TCPServer
>python TCPClient
Once the client is running it will ask for user input. Type a
string in lower case. The client should print the corresponding
upper case string received from the server.
If you encounter an error message that the port is already in use, change the server port number in both client and server programs (it is currently 12000), someone else may be running the same program at that time. Look for a comment that says #change this port number if required.
Here are some very useful resources:
C:
Beej's Guide to Network Programming
TCP/IP Socket Programming in C
Java
Java Socket Programming (PDF)
Sockets Programming in Java: A tutorial
All about Sockets (by Sun)
Python
Socket Programming in Python (IBM)
Makefile
Using make and writing Makefiles
Resource created Saturday 04 September 2021, 10:47:45 AM, last modified Monday 06 September 2021, 01:02:22 PM.
file: 11.docx