problems sending UDP packet to broadcast addr

problems sending UDP packet to broadcast addr

Post by Philip Bro » Wed, 24 Jul 2002 15:14:02



I'm hoping someone can help me figure out why I cant use
sendto() to send a UDP packet to a broadcast address under linux.

Lets say the normal IP is 192.168.1.1
I can use the same code on solaris, to bind to 192.168.1.1, and then
use sendto() to send a packet to 192.168.1.255

But on linux (either as regular user, or as root), I get an error,
 send failed: Permission denied

(the 'Permission denied' is from perror() )

Any suggestions?

If someone wants to play with real code, you can get it from

http://www.bolthole.com/freeha/freeha-0.9.tar.gz

--
[Trim the no-bots from my address to reply to me by email!]
[ Do NOT email-CC me on posts. Pick one or the other.]

http://www.spamlaws.com/state/ca1.html

 
 
 

problems sending UDP packet to broadcast addr

Post by 8eb9d4d234973.. » Wed, 24 Jul 2002 16:05:08


|I'm hoping someone can help me figure out why I cant use
|sendto() to send a UDP packet to a broadcast address under linux.

Did you call setsockopt to enable broadcast? It's one of the setsockopt
options.

 
 
 

problems sending UDP packet to broadcast addr

Post by M?ns Rullg? » Wed, 24 Jul 2002 16:19:05



> I'm hoping someone can help me figure out why I cant use
> sendto() to send a UDP packet to a broadcast address under linux.

> Lets say the normal IP is 192.168.1.1
> I can use the same code on solaris, to bind to 192.168.1.1, and then
> use sendto() to send a packet to 192.168.1.255

> But on linux (either as regular user, or as root), I get an error,
>  send failed: Permission denied

> (the 'Permission denied' is from perror() )

> Any suggestions?

You need to set socket option SO_BROADCAST.

--
M?ns Rullg?rd

 
 
 

problems sending UDP packet to broadcast addr

Post by Philip Bro » Wed, 24 Jul 2002 17:12:28



>|I'm hoping someone can help me figure out why I cant use
>|sendto() to send a UDP packet to a broadcast address under linux.

>Did you call setsockopt to enable broadcast? It's one of the setsockopt
>options.

aha... interesting;    setsockopt(SO_BROADCAST)

and its a standard, so I wonder why I got away with not using it, for
solaris.

thanks.

--
[Trim the no-bots from my address to reply to me by email!]
[ Do NOT email-CC me on posts. Pick one or the other.]

http://www.spamlaws.com/state/ca1.html

 
 
 

1. send udp packet to broadcast address

i would like to send a udp packet to the broadcast address out of a java
application - using java.net.DatagramSocket.
this works fine under windows nt, but under linux (SuSE Linux 6.1,
Kernel 2.2.7) i receive a "Permission Denied Exception".

if i try to ping the broadcast address, e.g. 192.168.0.255, under
windows nt, this works fine,
under linux i receive something like "ping: sendto: no permission".

i conclude it's a question of permission.

how can i configure my linux-box to allow sending of udp packets to the
broadcast address?

thanks
robert

--

2. mountd & nfsd can't register udp

3. Problem receiving UDP broadcast packets.

4. Anyone successfully installed libc-4.5.26?

5. udp broadcast packet size limit?

6. How to connect to Novel Server

7. reply to broadcast packets to UDP port 177 (XDM)

8. berkeley db 1.85

9. Unknown UDP Broadcast packets

10. broadcasting UDP packets

11. broadcast packets to UDP port 177 (XDM)

12. Send a broadcast in UDP

13. Send a broadcast with UDP