How can i find my LAN IP Address using std.socket?

Dicebot public at dicebot.lv
Tue Feb 4 14:31:52 PST 2014


On Tuesday, 4 February 2014 at 20:19:14 UTC, TheFlyingFiddle 
wrote:
> I'm setting up a simple local network enabling me to connect 
> phones to the computer through the local wi-fi. The simplest 
> way i could think of to make this work without relying on an 
> external server was to simply broadcast the ip and port to all 
> machines in the network.(Btw by server i mean my / my project 
> groups windows boxes).
>
> So well the problem is that i need a way for the phones to find 
> running servers on the LAN.

I think it is close to impossible to do in portable way. Most 
reliable approach is to get list of all configured network 
interfaces via posix functions (or via `system` call as least 
resort), filter out "lo" and broadcast message for every such 
interface. I think you can also filter only wireless interfaces 
that way relatively easily too.


More information about the Digitalmars-d-learn mailing list