Mike's Guide to the Sockets Lab

Forget Google to begin with!!! Try to break the lab down into 'easy' problems. To me the following are a reasonable set of steps. The list is ordered because you really need to attack things in order!!!

  1. dnsaccess.
    You should write a program that takes as input a dns name and spits out an IP address. I did this in 2 parts:

  2. echoclient.c, initial version
    This program should take two parameters, the server name and port. dnsaccess should be called to get the IP address. Then a socket should be set up to access the server. The socket creation function can be written such that the server function can use the same code to get a socket. You can convinced yourself that you have created a socket by printing out the socketid.
    Forget connecting for now, you should then write code to read in messages from standard input and print those messages out.

  3. echoserver.c, initial version
    The echoserver is a rewrite of the echoclient except for the bind operation and port assignment. Prove to yourself that you can set up the sockets and that you can loop through reading and writing data

  4. final versions of echoserver and echoclient
    Now put them together and make the sockets connect.

  5. possible header
    #include <netdb.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <err.h>
    


    Mike Erlinger

    Last Modified Tuesday, 23-Oct-2018 10:17:29 PDT