From: Jamie L. <ja...@sh...> - 2005-02-24 00:21:24
|
James Yonan wrote: > Listening on multiple sockets is also bad from a performance perspective > unless you are using a modern polling API such as epoll on Linux > 2.6. That's only an issue if you have lots of interfaces. If you only have a few, poll() will be fine. But, if you're going to have a little non-portability, it's much easier to use the IP_PKTINFO method of getting the incoming destination address and interface (IP_PKTINFO with recvmsg/sendmsg). That has the advantage that you don't need to enumerate the interfaces, and you don't need to track interface changes: you can just use the received pktinfo struct for sending out the same interface, without interpreting it. -- Jamie |