Yes. Host A and B have the same destination port numbers and thus, their UDP segments will arrive to the socket at host C. In this case, the UDP sockets are represented by the protocol IP and Port. Host C will be able to differentiate between them by doing a check on the source IP and source port from the UDP header.
Both UDP segments sent by Host A and Host B to Host C's port number 6789 will be directed to the same socket. Host C differentiates them based on their source IP addresses and source port numbers.
Explanation:If a process in Host C has a UDP socket with port number 6789, and both Host A and Host B send a UDP segment to Host C with destination port number 6789, both of these segments will indeed be directed to the same socket at Host C. This is because the port number serves as an identifier for incoming data traffic, ensuring that data is sent to the correct receiving application process.
Although both segments are directed to the same socket, the process at Host C can distinguish between the two segments because each UDP segment contains not only the destination port number but also the source IP address and the source port number from which it originated. These details provide enough information for the receiving process to differentiate between segments from Host A and Host B. In the analogy of an apartment building, where the port number would be the apartment number, the source IP address and source port number are analogous to the return address on a piece of mail. The combination of these uniquely identifies each sender.