From: Sai Hl Date: 2009-03-01T01:20:31+09:00 Subject: Gets the broadcast address of an IP address Hi Ruby communauty. I am trying to broadcast a message using UDPSocket on destination port 10000. My code is: client = UDPSocket.new client.connect Socket.gethostname, 10000 client.setsockopt(Socket::SOL_SOCKET, Socket::SO_BROADCAST, true) client.send data, 0 But my packet is not a broadcast, its address is the same as my host: 192.168.0.101 In order to do so on the external interface of my system (named en0), I had remplaced this: client.connect Socket.gethostname, 10000 by this: client.connect "192.168.0.255", 10000 And now this is working. But is there a way to get automatically the "192.168.0.255" address thanks to a Ruby method? I know I can get my IP with IPSocket.getaddress(Socket.gethostname) but I don't see any way to gets its broadcast address. Thanks -- Posted via http://www.ruby-forum.com/.