News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Get Local address

Started by Farabi, July 04, 2010, 01:22:38 PM

Previous topic - Next topic

Farabi

I got 5 computers connected to internet wirelessly. I want to retrieve the local address for each computers, so It can connect each other wirelessly directly without internet, how to do that?
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

box

You can generally use gethostname and gethostbyname to do this programmatically on windows 2000 and later. If I'm just testing a server program I usually just use ipconfig to get it's ip and hard-code it.

joemc

on each machine go to start -> run -> type "cmd" -> hit enter -> type "ipconfig" -> hit enter -> look at ip address

or use a web browser to connect to most "walmart" type routers. goto http://192.168.1.1 or 192.168.2.1 or could be many others depending on setup.   from the ipconfig look at "default gateway".  many times the router will show everyone that is connected.

dedndave

this won't help you if you are trying to write an all-purpose program
but, i use DHCP reservations
that way, each computer is assigned the same local IPA everytime

Farabi

Maybe someone experienced with iphlpapi.dll?

I saw this function there
Quote
GetIpAddrTable
The GetIpAddrTable function retrieves the interface–to–IP address mapping table.

What is interface mean? the WLAN hub or something?
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

Farabi

Quote from: box on July 04, 2010, 04:23:36 PM
You can generally use gethostname and gethostbyname to do this programmatically on windows 2000 and later. If I'm just testing a server program I usually just use ipconfig to get it's ip and hard-code it.

If I had the IP address should I ping it first before I can connect to it? I had no experience on networking.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

Farabi

Quote from: joemc on July 04, 2010, 05:37:05 PM
on each machine go to start -> run -> type "cmd" -> hit enter -> type "ipconfig" -> hit enter -> look at ip address

or use a web browser to connect to most "walmart" type routers. goto http://192.168.1.1 or 192.168.2.1 or could be many others depending on setup.   from the ipconfig look at "default gateway".  many times the router will show everyone that is connected.

I tried to connect to http://192.168.1.1/ using browser and it show a webpage for setup my connection, what to do next?
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

box

Quote from: Farabi on July 05, 2010, 03:06:12 AM
If I had the IP address should I ping it first before I can connect to it? I had no experience on networking.
No need, just test whether connect() fails (TCP) or you get no response (UDP). If you are just using this on your own network you can use ping to make sure a given host is reachable, but it's not good practice to rely on pings if you are going to be connecting to other people at some point since they are sometimes disabled.


What exactly are you trying to do?

Farabi

Quote from: box on July 05, 2010, 04:17:57 AM
Quote from: Farabi on July 05, 2010, 03:06:12 AM
If I had the IP address should I ping it first before I can connect to it? I had no experience on networking.
No need, just test whether connect() fails (TCP) or you get no response (UDP). If you are just using this on your own network you can use ping to make sure a given host is reachable, but it's not good practice to rely on pings if you are going to be connecting to other people at some point since they are sometimes disabled.


What exactly are you trying to do?

Im going to make a local server for my campus, one of the computer will be the data storage so other computer can see the data but cant modify it.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

Farabi

Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"