Re: polling an intranet for a device type
- From: "tony@avonwood" <tanda@xxxxxxxxxx>
- Date: Mon, 2 Feb 2009 17:02:57 -0000
Hi,
I've found some VB code that achieves what I want to do, but i'm unsure how
to recreate it.
The form has a UDP component, with a reomte host of 255.255.255.255
assigned, and an event to handle a UDP data arrival.
The UDP then does a network send and all devices are pciked up from the
event handler.
What event would you associate with the UDP?
I have to disappear now before we get snowed but I can provide more detailed
data later.
TIA
Tony
"tony@avonwood" <tanda@xxxxxxxxxx> wrote in message
news:OMMpTIVhJHA.4556@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
You've probably guessed from posts that I'm new to Socket programming,
hence my posts being lacking in the content you require.
I'm looking to collate a list of specific devices on a network by sending
a network message which our network devices will respond to, but
non-specific devices (in this case PC's, printers etc) will ignore.
I'm needing to send this command from my PC (or whichever PC is running
the application) across a local intranet. I am not sure whether it is
better to use TCPIP or UDP. Once our devices have responded I am then able
to collate a list of addresses for our devices and then use that to
communicate with a specific chosen device from that list.
I have succeeded in communicating 1 to 1 with a known IP address, but I am
struggling to to collate a list of our devices connected to my network.
Our devices are capable of UDP and TCP.
I'm thinking I will need to use UDP for a network broadcast, and TCP for
an individual socket connection?
Thanks for your hlp so far.
"Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx> wrote in message
news:op.uopb0qrk8jd0ej@xxxxxxxxxxxxxxxxxxxx
On Sun, 01 Feb 2009 17:17:32 -0800, Ken Foskey
<rmove.foskey@xxxxxxxxxxxxxxxx> wrote:
[...]
I have been thinking about this, I haven't written the code yet but
something like:
for( i = 1; i < 255; i++ )
{
IPaddress = string.format("192.168.1.{0}", i )
connect to your specific port, eg ssh
if( connect ok )
list.add( IPaddress );
disconnect.
}
As far as pseudo-code goes, I guess that's fine. However, note that the
above code will be extremely slow on a sparsely populated network,
because every connection attempt that fails won't do so until a
several-second timeout occurs.
The OP hasn't provided any more details about his problem. Not about
what protocols the devices support or respond to, nor about what level of
network programming experience he has, or even the exact nature of his
question. Speaking hypothetically though, the ideal situation would be
network devices that respond in a unique, well-defined way to a UDP
broadcast. Then the querying computer could just broadcast a message
asking for relevant devices to respond. Optimizations to the protocol
could be made to deal with network congestion issues, if having every
device respond to a single query results in some of those responses being
lost.
If indeed a TCP connection to each device is required, then rather than a
serialized enumeration of each IP address, I would use the asynchronous
pattern for the Socket class (or TcpClient, according to one's
preference), so that failed connections don't slow down detection of the
successful ones. It would require up to 254 sockets to exist
simultaneously, which is not a problem at all.
But, who knows whether any of this is useful to the OP at all. Unless he
comes back and continues the thread, we're just shooting in the dark.
Pete
.
- Follow-Ups:
- Re: polling an intranet for a device type
- From: Peter Duniho
- Re: polling an intranet for a device type
- References:
- Re: polling an intranet for a device type
- From: Ken Foskey
- Re: polling an intranet for a device type
- From: Peter Duniho
- Re: polling an intranet for a device type
- From: tony@avonwood
- Re: polling an intranet for a device type
- Prev by Date: [OT] Plurlize() Method
- Next by Date: Convert string --> XML
- Previous by thread: Re: polling an intranet for a device type
- Next by thread: Re: polling an intranet for a device type
- Index(es):
Relevant Pages
|