Re: scanning for network printers?
Re: scanning for network printers?
- Subject: Re: scanning for network printers?
- From: Mike Cohen <email@hidden>
- Date: Sat, 16 Jul 2005 20:47:25 -0400
If the printers respond to ping requests, you can try sending an ICMP
ping to the broadcast address (usually x.x.x.255) to see which IP
addresses actually have some device so you don't have to try all 253
addresses.
On Jul 16, 2005, at 7:47 PM, Scott Ribe wrote:
the trouble is, if I try this on an address there is no
device, it takes about 60 seconds to time out
The only way I know to do this is, using BSD sockets:
- set the socket to non-blocking using fcntl
- call connect
- call select on the socket with a timeout, assuming it didn't already
connect in the prior step
- check several conditions to figure out whether you connected, got an
error, timed out...
That much is covered in the book "Effective TCP/IP", which I
recommend to
you because there's subtleties...
- Even so, this is going to take too long to do one at a time if
you allow
any remotely reasonable timeout.
- Seems you'd need to try multiple connects at once. I suppose that
if you
you follow the above and try to connect on multiple addresses and
select on
them all at once that might work concurrently. If not, you're
looking at
multiple threads.
- You wouldn't want to just go through 253 IP addresses, you'd need to
figure out the actual subnet in use.
- You'd have to watch out for the per-process descriptor limit.
- You'd need to check for multiple interfaces.
- Is this a well-known port implementing a standard service (LPR/
515 for
instance), not used by any other service? If not, you run the risk of
connecting to some other device. If you try to confirm that you are
connected to your printer, you run the risk of confusing the other
device
with commands it's not prepared to handle...
Are you sure you want to do this?
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 665-7007 voice
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mcdevzone.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden