[#3006] mismatched quotation — "stevan apter" <apter@...>

ruby documentation uses a punctuation convention i've never seen

13 messages 2000/05/27

[ruby-talk:02913] [1.5] UDPSocket / SAFE

From: ts <decoux@...>
Date: 2000-05-20 16:14:53 UTC
List: ruby-talk #2913
 With 1.5, I can open an UDP socket and send a message in non connected
 mode, i.e. this work :

pigeon% cat b.rb
#!./ruby
require  'socket'
Thread.abort_on_exception = true
s = Thread.start do 
    server = UDPSocket.open
    server.bind(nil, 2036)
    p server.recvfrom(124)
end
Thread.start do
    $SAFE = 4
    UDPsocket.open.send('aaaa', 0, 'localhost', 2036)
end
s.join
pigeon% b.rb
["aaaa", ["AF_INET", 1194, "localhost", "127.0.0.1"]]
pigeon% 


 and I've an error in connected mode, i.e. :

pigeon% cat b.rb
#!./ruby
require  'socket'
Thread.abort_on_exception = true
s = Thread.start do 
    server = UDPSocket.open
    server.bind(nil, 2036)
    p server.recvfrom(124)
end
Thread.start do
    $SAFE = 4
    client = UDPsocket.open
    client.connect('localhost', 2036)
    client.send('aaaa', 0)
end
s.join
pigeon% b.rb
./b.rb:13:in `send': Insecure operation `send' for level 4 (SecurityError)
        from ./b.rb:13
        from ./b.rb:10:in `start'
        from ./b.rb:10
./b.rb:13:in `start': Insecure operation `start' for level 4 (SecurityError)
        from ./b.rb:10
pigeon% 

 It's normal ?

 It was not possible to open a socket in 1.4.


Guy Decoux

In This Thread

Prev Next