J Finn wrote:
> I've got a quick question I'm hoping someone can answer.
> 
> If I've got a server with 3 interfaces on three different network, Is  
> there a portable way in perl to get the broadcast addresses of each  
> of those networks?
> 
> for example, if I've got an ip address: 192.168.1.33 and the netmask  
> is 255.255.255.192 (range .32-.63), how can I find the broadcast  
> address (192.168.1.63)?

If you have the IP and the netmask for each interface, then getting the 
broadcast address for each is trivial.

Use the addrandmask2cidr and cidr2range functions in Net::CIDR.  The 
broadcast address is always the one right at the top of the range.

-- 
David Cantrell | http://www.cantrell.org.uk/david

Do not be afraid of cooking, as your ingredients will know and misbehave
    -- Fergus Henderson
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to