r code where: i) A socket is created. ii) The properties of the created socket are filled in. Use the last 4 digits of your student ID (9 digit ID) as port number. iii) The created socket is associated with its properties using the appropriate system call and parameters. iv)Take the last digit of your student ID (9 digit ID); if it is an odd number you are going to write the code for a TCP server from the listening socket and
This question relates to Socket
write the part of the server code where:
i) A socket is created.
ii) The properties of the created socket are filled in. Use the last 4 digits of your
student ID (9 digit ID) as port number.
iii) The created socket is associated with its properties using the appropriate system call
and parameters.
iv)Take the last digit of your student ID (9 digit ID); if it is an odd number you are going to write
the code for a TCP server from the listening socket and all the steps of code after iii)
to allow the server to communicate with one client by receiving a request from the
client and sending the answer “I got your request!”. If the last digit of your student
ID (9 digit ID, 123456789) is an even number, you are going to write all the steps of code from iii) for a UDP
server to communicate with one client by receiving a request from the client and
sending the answer “I got your request!”.
Notes:
1. Inside the code you must add meaningful explanatory comments to major
commands and semantics of what the control structures are performing in relation
to the realisation of the code. Comments must be short, clear, and objective about
how the code will perform.
2. The code you write for parts i) to iv) above must use the variables declared in
Figure 4. Code dump will not be accepted as an answer.
3. In Figure 4, some parts of the code are omitted due to space limitation, but all the
necessary code for answering the question is shown in the figure.
Step by step
Solved in 3 steps