What is the data actual path if I run 2 applications sending/receiving data using sockets through TCP loopback? Will this data go through Windows network driver and/or NIC hardware?
EDIT. Please consider this is not Windows ‘loopback’ but physical loopback made on the NIC with 2 ports connected with a cable to each other making it physical loopback.
Loopback is a virtual interface, there’s no hardware corresponding to it. Data copy happens inside the kernel even above the driver level.
Edit 0:
You are mixing two different things – loopback in TCP/IP is a virtual network interface with a special address in subnet
127/8, usually127.0.0.1, which is created for you by default, and ethernet crossover cable looping between two cards on the same machine.I addressed the first case in my initial answer.
The behavior of the TCP/IP stack in the second case depends on the implementation and the transport options. For a TCP connection and for unicast UDP the kernel might just realize that both source and target addresses are local to the machine and short-circuit data transfer through memory. You’ll find that most modern network stacks behave this way. For broadcast or multicast UDP there’s no other option but to send packets through physical card since there might be other listeners on the network.