4P13
Lab 2
Objective
- Introduction to Sockets and socket programming.
Lab Component
- Using FireFox go to http://beej.us/guide/bgipc/output/html/multipage/unixsock.html.
Here you will find a simple local domain example of client and
server. The example will put up a server which will echo
back to the client any message sent to it.
- You will need to compile both files and execute them in
separate windows.
- Modify the above example, to be network capable. This will
require you to use AF_INIT domain.
- Try it on your local machine 127.0.0.1 which is the default
local IP address of the host adapter. localhost should
also work.
- Try connecting to another students machine.
Reward Requirements
- Annotate the code from the above 2 exercises. The annotations
should accurately describe what each section of code does and
why it does what it does.
- Print it and submit it.
- If you want to know what an annotation should look like, visit
http://wiki.treck.com/Introduction_to_BSD_Sockets