-
A client process P needs to make a TCP connection to a server process S. Consider the following situation. The server process S executes a socket (), a bind () and a listen () system call in that order, following which it is preempted. Subsequently, the client process P executes a socket () system call followed by connect () system call to connect to the server process S. The server process has not executed any accept () system call. Which one of the following events could take place?
-
- Connect () system call returns successfully
- Connect () system call blocks
- Connect () system call returns an error
- Connect () system call returns in a core dump
- Connect () system call returns successfully
Correct Option: C
In a TCP connection The process is
P ........ Flag → S
P ........ Sync → S
P ........ ACK → S
P ........ Data Transfer → S
If any error occurs connect () system call returns an error. The handshake (TCP Handshaking) between sender and receiver is established by connect () so that SYN packets could be sent. Now, to send these packets, server should execute accept () in return so that connect () gets an acknowledgement and a handshake could occur. Since, there is no Handshake, error occurs.