Возможно ли иметь несколько сокетов, связанных с одним интерфейсом (например, портом Ethernet) с разными протоколами, UDP, TCP, RAW и т. д., поэтому, если пакет отправляется через Ethernet, он принимается только правильным сокетом.
Несколько протоколов для одного интерфейса
Ответы (1)
Я думаю, вы говорите об отношении между номером порта, используемым при разговоре о сокетах, и порте Ethernet.
A Socket (TCP/UDP) Works in the Transport Layer.
A port number comes here in the Layer and this is not the Ethernet port.
You can have a TCP Socket bound to say port 88 as well as a UDP Socket bound to port
88.
You may also have raw sockets, which can directly use the IP Headers.
This may require root/administrative priviledge.
Here seems you need to decode the IP packets and get to the specific protocol
on top it.
(There is a field in the IP header called Protocol which mentions which
upper layer protocol the packet belongs to)
So there can be several sockets, which finally get the data from your ethernet port.
Пожалуйста, обратитесь к следующим ссылкам для некоторых основных понятий,
http://en.wikipedia.org/wiki/Network_socket
http://en.wikipedia.org/wiki/Raw_socket
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frzab6%2Fhowdosockets.htm
person
Tanmoy Bandyopadhyay
schedule
23.07.2012