Real Software Forums
http://forums.realsoftware.com/

Automatically finding a LAN device's IP address
http://forums.realsoftware.com/viewtopic.php?f=2&t=46710
Page 1 of 1

Author:  srechter [ Sat Jan 26, 2013 11:06 am ]
Post subject:  Automatically finding a LAN device's IP address

I have a device on the LAN that gets its IP address using DHCP. I am trying to automatically discover its address.


My solution:

My RB app polls the LAN by stepping through all of the possible IP addresses and then calls a TCP socket connect. With each TCP socket connect it sends out a command to the device waiting for a response.

When my RB app receives the correct response the polling stops.


Results:

The process works perfectly on a Mac.

The process will not work on a PC.


Problem:

I can get it to work on a PC if I only limit the polling to a sequence of ten TCP connect calls. After ten TCP connect calls the PC ignores the remaining calls.

Restarting the RB app allows the ten TCP connect calls again.

I suspect that the PC has some kind of a TCP stack that is overflowing and locking up.

Author:  ktekinay [ Sat Jan 26, 2013 11:10 am ]
Post subject:  Re: Automatically finding a LAN device's IP address

Or some kind of anti-malware software that is preventing that kind of a scan. The device doesn't broadcast itself through Bonjour (ZeroConf)?

Author:  srechter [ Sat Jan 26, 2013 1:18 pm ]
Post subject:  Re: Automatically finding a LAN device's IP address

ktekinay wrote:
The device doesn't broadcast itself through Bonjour (ZeroConf)?


No, it's a homemade WIFI device.

Author:  p0wn3d [ Sat Jan 26, 2013 1:38 pm ]
Post subject:  Re: Automatically finding a LAN device's IP address

What OS version do you have on the PC and do you have the following registry key

HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services \Tcpip \Parameters]
EnableConnectionRateLimiting

Author:  srechter [ Sat Jan 26, 2013 5:09 pm ]
Post subject:  Re: Automatically finding a LAN device's IP address

I am running Windows XP and it does not have that registry key.

Author:  ktekinay [ Sat Jan 26, 2013 5:19 pm ]
Post subject:  Re: Automatically finding a LAN device's IP address

Are you reusing the same object on each call, or creating a new one? (I'd recommend the latter.)

Have you tried introducing a delay after the 10th call on the PC?

Author:  p0wn3d [ Sun Jan 27, 2013 8:10 am ]
Post subject:  Re: Automatically finding a LAN device's IP address

Windows XP imposes a limit of 10 simultaneous incomplete outbound TCP connection attempts so it's all going to be about timing in your application. You can patch tcp to increase the limit and see if that helps

http://www.lvllord.de/?lang=en&url=tools

Author:  srechter [ Sun Jan 27, 2013 10:57 am ]
Post subject:  Re: Automatically finding a LAN device's IP address

p0wn3d wrote:
Windows XP imposes a limit of 10 simultaneous incomplete outbound TCP connection attempts so it's all going to be about timing in your application. You can patch tcp to increase the limit and see if that helps


Many thanks.

I googled "event ID 4226" and read that this event is triggered because of a built-in Windows "security" feature (really a kludge) to keep malicious software from spamming.

The limit is only for incomplete connection attempts (exactly what my RB app is doing). Windows has no limit on completed IP connections.

It makes no sense to me for Windows to have a limit on incomplete connection attempts within a LAN sharing the same subnet.

Author:  p0wn3d [ Sun Jan 27, 2013 3:22 pm ]
Post subject:  Re: Automatically finding a LAN device's IP address

Quote:
really a kludge


I agree we developed an application that did a mass poll (TCP connect) to remote CCTV camera's and had the same issue.

But that's Microsoft for yer....

:wink:

Author:  pony [ Wed Jan 30, 2013 4:37 pm ]
Post subject:  Re: Automatically finding a LAN device's IP address

Maybe a little unorthodox, but how about using a shell prompt and doing the following.

First ping the broadcast address on your subnet
ping 10.12.12.255
then do a
arp -a

based on the returned MAC address you should see your device.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/