Computer Networks --- Xiannong Meng

Help Desk


  • Connected: An Internet Encyclopedia -- check it out if you have any questions related to the Internet!
  • For those of you who need refreshing on C or C++, try my CSCI 2330 courseware for help on the subject.
  • Examples of TCP/IP programming are provided here. The C and C++ programs are from Douglas Comer's network books site. The Java programs are from Gary Cornell and Cay S. Horstmann's ``Core Java'' book (second edition) with some modification.
  • Berkeley socket version of whois program. Get the client.c and the server.c and the makefile, compile and run them on UNIX.
  • A simple client/server program with my tcplib. Get all files in the directory, compile and run them on UNIX system.
  • AT&T TLI socket version of a TCP echo program. To make this program work, save the Makefile, TCPecho.c, clientTCP.c, clientTLI.c, and errexit.c into one directory, then type make to compile the program, then type tcpecho host to run the program. After the program starts, type some message on the screen to see what happens.
  • The same TCP echo program in winsock version running on WindowsNT or Windows95 or Windows2000. Save tcplib.cpp, tcplib.h, server.cpp, client.cpp In this version of tcplib, you have the same API as you saw in the UNIX version of the program.
  • The same TCP echo program in winsock version running on WindowsNT or Windows95. Save tcplib.cpp, tcpecho.cpp, tcpechod.cpp, and makefile into one directory, at the MS-DOS prompt, type nmake if using VC++, then type tcpecho host to run the program. After the program starts, type some message on the screen to see what happens. If you are using BC++, you need to save this makefile.bcc into one directory, at the MS-DOS prompt, type make -f makefile.bcc before you can run the program.

    Click here for a brief instruction to compile and execute network program using BC++ in the labs in Academic Service Building.

  • For your convenience, I've put together a tcp library that you may use directly on Solaris. It has two parts, the tcplib.c and the tcplib.h. Here is an example how to use it.
  • The same tcplib for Windows environment (WinSocket) and an example of using it which has a server and a client program.

    To compile this set of program under VC++, you need to include tcplib.cpp in the file (i.e. tcplib.cpp and tcpecho.cpp as one set, tcplib.cpp and TCPechod.cpp as another set). Make sure add wsock32.lib to the library modules (in Project Setting/Link). When compiling the server program, you also need to set multiple thread option (in Project Setting/C++/Code Generation/Use run-time library). If you will use I/O on the server side, you also need to include libcmtd.lib in your linking libraries.

  • The same TCP echo program in Java running on any platform where a Java compiler/interpreter is avaiable. Save EchoClient.java to a directory, then type javac EchoClient.java to compile the program, and type java EchoClient host to run the program. Note that when compiling the program, there has to be a ``java'' extention; when running the program there is no ``java'' extention.
  • An example of TCP server and client program in Java. Save ThreadEchoServer.java, ThreadEchoHandler.java, EchoClient.java and makefile into a directory. Type make to compile the program. Then type java ThreadEchoServer to start the server, on a different computer, type java EchoClient to start the client.
  • If you need help on winsock (Windows socket programming), select the following links.
  • An Appendix for the ``Windows Sockets Network Programming'' by Bob Quinn and Dave Shute.
  • A rich collection of winsock resources at http://www.tucows.com/.
  • Douglas Comer's network books including the ``Internetworking with TCP/IP'' series.
  • A very helpful socket programming note from CSU-Chico
  • A C++ example of bit-wise operation.