[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

undefined method `recvfrom_nonblock'

Michael P. Soulier

9/24/2006 3:07:00 AM

Hey,

The socket docs at http://www.ruby-doc.o... say that UDPSocket has a
method, recvfrom_nonblock, but when I try to use it, I get this.

./bin/../lib/net/tftp+.rb:526:in `download': undefined method
`recvfrom_nonblock' for #<UDPSocket:0xb7f976b4> (NoMethodError)
from ./bin/../lib/net/tftp+.rb:522:in `download'
from ./bin/tftp_client.rb:81:in `main'
from ./bin/tftp_client.rb:98

msg, sender = sock.recvfrom_nonblock(MaxBlkSize)

The docs are for 1.8.4, and that's what I'm using. Any idea what's up here?

Thanks,
Mike
--
Michael P. Soulier <msoulier@digitaltorque.ca>
"Any intelligent fool can make things bigger and more complex... It
takes a touch of genius - and a lot of courage to move in the opposite
direction." --Albert Einstein
11 Answers

Michael P. Soulier

9/24/2006 11:45:00 AM

0

On 24/09/06 Francis Cianfrocca said:

> Sync to the latest Ruby. I'm not sure about that specific API but a bunch of
> changes were made to nonblocking I/O late last May,

Is the latest Ruby not 1.8.4? The docs say that they are for that version, and
that's what I'm running. What gives?

Mike
--
Michael P. Soulier <msoulier@digitaltorque.ca>
"Any intelligent fool can make things bigger and more complex... It
takes a touch of genius - and a lot of courage to move in the opposite
direction." --Albert Einstein

Paul Lutus

9/24/2006 3:28:00 PM

0

Michael P. Soulier wrote:

> On 24/09/06 Francis Cianfrocca said:
>
>> Sync to the latest Ruby. I'm not sure about that specific API but a bunch
>> of changes were made to nonblocking I/O late last May,
>
> Is the latest Ruby not 1.8.4? The docs say that they are for that version,
> and that's what I'm running. What gives?

The latest stable release is 1.8.5:

http://www.ruby-lang.org/en/news/2006/08/29/ruby-1-8-5...


>
> Mike

--
Paul Lutus
http://www.ara...

Michael P. Soulier

9/25/2006 1:02:00 AM

0

On 25/09/06 Paul Lutus said:

> The latest stable release is 1.8.5:
>
> http://www.ruby-lang.org/en/news/2006/08/29/ruby-1-8-5...

Yes, but at http://www.rub..., the links say 1.8.4.

[msoulier@tigger ~]$ ruby -v
ruby 1.8.4 (2005-12-24) [i686-linux]

Mike
--
Michael P. Soulier <msoulier@digitaltorque.ca>
"Any intelligent fool can make things bigger and more complex... It
takes a touch of genius - and a lot of courage to move in the opposite
direction." --Albert Einstein

Paul Lutus

9/25/2006 1:12:00 AM

0

Michael P. Soulier wrote:

/ ...

> Yes, but at http://www.rub..., the links say 1.8.4.

Probably because there is no documentation that is specific to 1.8.5.

--
Paul Lutus
http://www.ara...

Michael P. Soulier

9/25/2006 1:22:00 AM

0

On 25/09/06 Paul Lutus said:

> > Yes, but at http://www.rub..., the links say 1.8.4.
>
> Probably because there is no documentation that is specific to 1.8.5.

And yet 1.8.5 is the latest stable. Releasing a new version without up-revving
the documentation simply staggers me. Ruby has a long way to go on its
documentation story.

Mike
--
Michael P. Soulier <msoulier@digitaltorque.ca>
"Any intelligent fool can make things bigger and more complex... It
takes a touch of genius - and a lot of courage to move in the opposite
direction." --Albert Einstein

Michael P. Soulier

9/25/2006 11:24:00 AM

0

On 25/09/06 Francis Cianfrocca said:

> That's what I expected. Update Ruby, get past the documentation issue, and
> you should be ok with nonblocking i/o. In regard to timing, I would use
> select rather than SIGALRM.

I find it odd that there are multiple released 1.8.4s. That's never happened
with any other language that I use.

I ended up using Timeout::timeout to timeout my recvfrom call. You're right,
in general, select/poll would be better.

Mike
--
Michael P. Soulier <msoulier@digitaltorque.ca>
"Any intelligent fool can make things bigger and more complex... It
takes a touch of genius - and a lot of courage to move in the opposite
direction." --Albert Einstein

Austin Ziegler

9/25/2006 11:43:00 AM

0

On 9/25/06, Michael P. Soulier <msoulier@digitaltorque.ca> wrote:
> On 25/09/06 Francis Cianfrocca said:
> > That's what I expected. Update Ruby, get past the documentation issue, and
> > you should be ok with nonblocking i/o. In regard to timing, I would use
> > select rather than SIGALRM.
> I find it odd that there are multiple released 1.8.4s. That's never happened
> with any other language that I use.

There aren't. I think you're missing out on several factors and reacting badly.

1. ruby-doc.org is not maintained by the core Ruby website folks.
James Britt, the maintainer of ruby-doc.org, does so on his time. The
core Ruby website is and always has been ruby-lang.org and can be
considered more up-to-date than most other websites about Ruby with
respect to releases. ruby-doc.org is good, but it is an independent
but related project, not part of the main website.

2. There was only one *release* of Ruby 1.8.4. There wasn't even a
security patch (1.8.4.z) released. After release, there are dated
stable snapshots available. It is possible to get a Ruby 1.8.5 that
has further fixes available with recent changes as of right now. But
if you download Ruby 1.8.5, you're getting ONLY what was released
there.

-austin
--
Austin Ziegler * halostatue@gmail.com * http://www.halo...
* austin@halostatue.ca * http://www.halo...feed/
* austin@zieglers.ca

Michael P. Soulier

9/25/2006 1:30:00 PM

0

On 25/09/06 Austin Ziegler said:

> There aren't. I think you're missing out on several factors and reacting
> badly.
>
> 1. ruby-doc.org is not maintained by the core Ruby website folks.
> James Britt, the maintainer of ruby-doc.org, does so on his time. The
> core Ruby website is and always has been ruby-lang.org and can be
> considered more up-to-date than most other websites about Ruby with
> respect to releases. ruby-doc.org is good, but it is an independent
> but related project, not part of the main website.
>
> 2. There was only one *release* of Ruby 1.8.4. There wasn't even a
> security patch (1.8.4.z) released. After release, there are dated
> stable snapshots available. It is possible to get a Ruby 1.8.5 that
> has further fixes available with recent changes as of right now. But
> if you download Ruby 1.8.5, you're getting ONLY what was released
> there.

Core site or not,

http://www.ruby-lang.org/en/docu...

points to ruby-doc as it's standard and core library references. They
shouldn't do that if they're not vouching for their authenticity.

I downloaded the 1.8.4 tarball long after it was considered the stable
release, AFAIK. If there was only one release, then I got it. The links to the
1.8.4 docs should lead one to docs on 1.8.4, yes?

If one goes to http://www.pytho..., you get docs for the latest release
that are up-to-date, and maintained by the project itself. More importantly,
as you're likely not using the latest version in production, you can go to
http://www.pytho...versions/ and get old versions for your version. You
can also separately browse the in-development versions. It's always clear what
you are looking at.

Now, if it's very difficult to keep these up-to-date, then there are issues
within the Ruby development community to solve, since the tools are there.
Otherwise, it would be very nice to see the Ruby development community
maintain a model like I've referenced here. I constantly find it difficult to
get the information that I need to effectively use the language, and I don't
think that I'm alone.

It's worth the battle so far, as I am _loving_ the language. Still, the
pickaxe book as an API reference is incomplete. ruby-doc says it's showing
1.8.4 but it's apparently not. There's a free pickaxe book online from the 1.6
stream. I get inconsistent results on the code in the tarball from the ri
tool. This is an exercise in frustration. I have precious little free coding
time for my own projects, and I don't want to spend it crawling through Ruby
source trying to decipher the API. It's very difficult to justify my using it
internally at work when I'm surrounded by Java people who have far better
documentation than me.

How can I help this situation? I guess I'll start by talking to the owners of
ruby-doc, and seeing if I can help.

Mike
--
Michael P. Soulier <msoulier@digitaltorque.ca>
"Any intelligent fool can make things bigger and more complex... It
takes a touch of genius - and a lot of courage to move in the opposite
direction." --Albert Einstein

MonkeeSage

9/25/2006 2:10:00 PM

0

Michael P. Soulier wrote:
> I downloaded the 1.8.4 tarball long after it was considered the stable
> release, AFAIK. If there was only one release, then I got it. The links to the
> 1.8.4 docs should lead one to docs on 1.8.4, yes?

I guess if those were supposed to be the 1.8.4 docs, then yeah. But
they say right in the page you linked to, under the second heading;
"What You'll Find Here":

"Because the source code comments go straight into Ruby's CVS, the only
way to get up-to-date documentation is to use the latest Ruby code as a
source. There are two important side effects here:

* the documentation may be ahead of Ruby 1.8.0, which many users
will have, and
* the documentation is certainly out of step with Ruby 1.6.x.

The ruby_1_8 branch of the Ruby source code is used to produce the
documentation. So you will see the latest that Ruby 1.8.x has to offer,
not the experimental 1.9." ( http://www.ruby-doc.o... )

And what's the latest 1.8.x?

According to http://www.ruby-lang.org/en/... , it is 1.8.5.

If you want the documentation for your particular version, why not use
the built in ri command (like python's pydoc), or the help() method
from irb (like python help())? Or just run rdoc on the source yourself?
Or use http://stdlib-doc.rubyforge.org/rdoc/... ?

Regards,
Jordan

James Britt

9/25/2006 7:19:00 PM

0

Michael P. Soulier wrote:
> On 25/09/06 Paul Lutus said:
>
>
>>The latest stable release is 1.8.5:
>>
>>http://www.ruby-lang.org/en/news/2006/08/29/ruby-1-8-5...
>
>
> Yes, but at http://www.rub..., the links say 1.8.4.

That link is wrong. I forgot to update it.

The site fetches the current code for the latest release from CVS, so
the API docs should always reflect that. The page links, which are
maintained by hand, might fall behind at times.

Thanks for bringing this to my attention.


You should be able to see the actual 1.8.4 core API docs at

http://www.rub...core-1.8.4/


--
James Britt

"To predict the behavior of ordinary people in advance, you only have to
assume that they will always try to escape a disagreeable situation with
the smallest possible expenditure of intelligence."
- Friedrich Nietzsche