View Single Post
Old 08-26-2012, 04:55 AM   #94
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Ah well, then you are down to doing lots of networking magic. At least on linux, what I would do is examine the routing table, find the default gateway and then pick the interface address that falls in the same subnet as the gateway. That should take care of 90% of these cases. While I (more or less) know how to do that on linux, I have no idea on the other platforms.

Another alternative is to get a list of interfaces and ask the user to choose, though this is less friendly.
kovidgoyal is offline   Reply With Quote