Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > UDP Broadcast Packet (offtopic)

Reply
Thread Tools

UDP Broadcast Packet (offtopic)

 
 
Martin Farnik
Guest
Posts: n/a
 
      07-04-2003
Hi,
I've problem to send UDP Packet with broadcast address from ruby (in Linux).

When i run this code:

require 'socket'

UDPSocket.open.send(ArtPoll, 0, "2.255.255.255",0x1936)

I get
../ethtest.rb:28:in `send': Permission denied - "sendto(2)" (Errno::EACCES)
from ./ethtest.rb:28

Thanks for answars

Martin Farnik

email:(E-Mail Removed)




 
Reply With Quote
 
 
 
 
ts
Guest
Posts: n/a
 
      07-04-2003
>>>>> "M" == Martin Farnik <(E-Mail Removed)> writes:

M> I get
M> ../ethtest.rb:28:in `send': Permission denied - "sendto(2)" (Errno::EACCES)
M> from ./ethtest.rb:28

You must call #setsockopt to specify the option Socket::SO_BROADCAST,
before calling #send


Guy Decoux









 
Reply With Quote
 
 
 
 
Josef 'Jupp' Schugt
Guest
Posts: n/a
 
      07-04-2003
Saluton!

* Martin Farnik; 2003-07-04, 09:49 UTC:
>
> require 'socket'
>
> UDPSocket.open.send(ArtPoll, 0, "2.255.255.255",0x1936)
>
> I get
> ../ethtest.rb:28:in `send': Permission denied - "sendto(2)" (Errno::EACCES)
> from ./ethtest.rb:28


I get 'uninitialized constant ArtPoll (NameError)'

Gis,

Josef 'Jupp' Schugt
--
Someone even submitted a fingerprint for Debian Linux running on the
Microsoft Xbox. You have to love that irony .
-- Fyodor on http://www.velocityreviews.com/forums/(E-Mail Removed)

 
Reply With Quote
 
ts
Guest
Posts: n/a
 
      07-04-2003
>>>>> "J" == Josef 'Jupp' Schugt <(E-Mail Removed)> writes:

J> I get 'uninitialized constant ArtPoll (NameError)'

Well, if you want an example

svg% cat b.rb
#!/usr/bin/ruby
require 'socket'
s = UDPSocket.open
s.setsockopt(Socket::SOL_SOCKET, Socket::SO_BROADCAST, 1)
p s.send("moulon.inra.fr", 0, "138.102.114.255",0x1936)
svg%

svg% b.rb
14
svg%

comment the line with #setsockopt and you'll have an error


Guy Decoux

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDP broadcast does not work to loopback device without network connection? franklin.bowen@gmail.com Java 3 03-15-2006 08:20 PM
UDP broadcast does not work to loopback device without network connection? franklin.bowen@gmail.com Java 0 03-14-2006 09:27 AM
udp broadcast example, please Torsten Rueger Python 2 12-20-2003 12:12 PM
Re: udp broadcast example, please Jp Calderone Python 0 12-17-2003 03:27 PM
UDP Broadcast problem Mark van Heeswijk C++ 2 09-01-2003 04:10 PM



Advertisments