Reputation: 5860
Let's say, I have a nic, it has two addresses 10.0.1.1 and 10.0.1.2, and I have four processes with one socket each, 1 is using tcp with 10.0.1.1:30, 2 is using udp with 10.0.1.1:30, 3 is using tcp with 10.0.1.2:30, 4 is using udp 10.0.1.2:30.
Are those four socket's all receive the same packets or who differs from who? Does the fact that four sockets are in one process affect the result?
Upvotes: 0
Views: 143
Reputation: 311054
You have:
TCP 10.0.1.1:30 UDP 10.0.1.1:30 TCP 10.0.1.2:30 UDP 10.0.1.2:30
They are all different. No packet intended for one of them can possibly be delivered to another.
Reasons:
So there is no overlap, ambiguity, sharing, ...
Upvotes: 1
Reputation: 598309
Sockets are identified by not only their IP/Port pairs, but also by their transports. That is why you have to specify the socket type when creating a socket, before it is even bound. So it is perfectly OK to have a TCP socket and a UDP socket both bound to the same IP/Port pairs, since their transports are different. A UDP packet cannot be routed to a TCP socket, and vice versa (they can be routed to a RAW socket, though). It makes no difference whatsoever if they are being used in the same process or in different processes.
Upvotes: 1
Reputation: 2362
EJP has given the right answer. In adition even though all the sockets are in the same process but still they will be receiving different packets.
Upvotes: 1