CENG320 Network Programming|Services

CENG320 Network Programming|Services
Part I: Looking up port #sThe file /etc/services is a lookup table of common services and their standard default port numbers available in Unix as defined by IANA – the Internet Assigned Numbers Authority. In Windows this table also appears in the file  The official list of standard port assignments can be found here:  1. Write and test a function in C char * getportname(portNo) based on the sample program services.c that reads in the /etc/services file one line at a time, tokenizes each line and returns the default text name for the port. Return 0 or -1 if the name does not exist. (2) 2. Write and test a similar function int getportnum(portNo) based on the sample program services.c that reads in the /etc/services file one line at a time, tokenizes each line, checks both the default name and the aliases and returns the associated port #. If the port does not exist it should return 0 (an invalid port #) or -1. (2) 3. Write a small command server that accepts 2 command to test a. & b: (4) a. port portNo #displays the default name or a not found message b. service name #display the port # associated with the name c. Create a test file of 5 searches for ports#s and 5 searches for port names including 2 examples using aliases and an example of an invalid port and an invalid name. Feed the list of commands to your program.
Read less
QUALITY: 100% ORIGINAL PAPER – NO PLAGIARISM – CUSTOM PAPER
error: Content is protected !!