0
votes

When two devices D1 and D2(on different networks) have processes P1 and P2 running respectively on them then if P1 wants to get data from P2 then -

P1 establishes TCP connection with P2 . P1 sends SYN packet.
P2 sends SYN-ACK packet.
P1 answers with ACK packet, concluding the three-way TCP connection establishment. After this HTTP request is sent over this TCP connection.

Lets say D1 and D2 are on the same network, will this process be faster and why.

1
"P1 establishes TCP connection with the IP address of P2." No, you are looking at that incorrectly. TCP establishes connections with TCP, not IP. The TCP in D1 establishes a TCP connection with the TCP in D2. Neither do the processes do the handshaking, that is up to TCP, freeing the processes from the complexity of the connection. - Ron Maupin

1 Answers

1
votes

The less time it takes for P1's message to reach P2 and vice versa, the faster this process will be. That time depends on a variety of factors, among them is the physical distance between the machines and the number and capacity of networking equipment and links along the way.

Since machines in a local network are typically close, with little networking equipment between them, a connection between should faster than if the machines are further apart.

Of course one could imagine scenarios in which that's not the case, but those would be atypical edge cases.