So guys on the screen listed is the pseudo code of the project.
This pseudo code will help you to get started with the implementation of your project.
This pseudo code actually captures the entire logic of your project, but at a slightly higher level.
Whenever you start your process in a terminal for some node, the node must create a TCP master socket
file descriptor and a UDP master socket file descriptor.
Right.
And to the read Fdset, the node must add both the UDP and TCP file descriptors which it has created.
In addition to this node must also add zero to this file descriptor set.
The file descriptor zero is a special value, which means your console.
Because the user has to interact with your application in order to provide, put or get request.
So your project or application not only should monitor the TCP file descriptor and UDP file descriptor,
but also your application should monitor the console.
So therefore select system call will be invoked on this read file descriptor, meaning that you are
monitoring all these three file descriptors at the same time.
So you can see that your application is monitoring TCP file descriptor and UDP file descriptor at the
same time.
It means that your application is behaving as TCP as well as UDP server at the same time.
Now, when the select system call Unblocks, you have to check that which file descriptor has been activated.
If the TCP file descriptor has been activated, it means that you have received some connection initiation
request from some other node in the topology.
And as per our project, you will going to receive what x get reply x or put reply X message on a TCP
connection from a remote node in the ring topology.
Similarly, if it is the UDP file descriptor which is activated, it means your node should process,
put forward message or get forward message which it has received from the previous node of the ring
topology.
Whereas if your console file descriptor is activated, it means that the user has issued put request
or get request on that particular node.
So this is the pseudo code that you should keep in mind and start implementation of your project on
the lines of this pseudo code.
And you can see that this entire logic is encapsulated inside an infinite loop.