Re: Raw Socket
- From: "markpapadakis" <markpapadakis@xxxxxxxxx>
- Date: 5 Sep 2006 13:24:45 -0700
Rainer Temme wrote:
markpapadakis wrote:
zwhermes@xxxxxxxxx wrote:
How can i use a Raw Socket to send a packet through a certain ethernet
card in a computer with several ethernet cards? I still have no idea
about that. I will really appreciate your help. Thanks.
o Examine the source code of programs that utilize this functionality.
o To send them over a given NIC, just bind() your socket's fd to that
NIC's assigned IP address.
o http://mixter.void.ru/rawip.html
Nope, binding a socket-fd to one of the local IP addresses only
makes sure, this address will be used as source address. If a packet
is routed out via a certain adapter or not is still depending on
the destination IP (and where that is routed to is looked up in the
routing table).
Nevertheless, I don't understand the wish to send a packet out via
a certain adapter...
If it is the 'right' way out for the given destination, then the
routingtable should route the packet there as well.
If its the 'wrong' way out, why would one want to send it there.
Whereas, the wish to us a certain of more than one local addresses
(as pointed out by Mark) is very useful at times.
Rainer
Well said. I was thinking about bind()ing to an IP address as a means
to listen() for accept()ing requests from a single interface only --
completely unrelated, of course, to the original question.
.
- References:
- Raw Socket
- From: zwhermes
- Re: Raw Socket
- From: markpapadakis
- Re: Raw Socket
- From: Rainer Temme
- Raw Socket
- Prev by Date: Re: Linux select command issues
- Next by Date: Re: Raw Socket
- Previous by thread: Re: Raw Socket
- Next by thread: Re: Raw Socket
- Index(es):
Relevant Pages
|
Loading