# Sysread error

**URL:** <https://rubytalk.org/t/sysread-error/47758>\
**Category:** ruby-talk\
**Created:** [17 July 2008 10:11 UTC](https://rubytalk.org/t/sysread-error/47758 "2008-07-17T10:11:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alfonso\_Caponi](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@Alfonso\_Caponi](https://rubytalk.org/u/Alfonso_Caponi)\
**Post date:** [17 July 2008 10:11 UTC](https://rubytalk.org/t/sysread-error/47758/1 "2008-07-17T10:11:08Z")

</div>

Hi List,

I wrote a simple script that import a file list of hosts and try to  
connect.  
Before the end of the file the script exits with this error:

/usr/lib/ruby/1.8/net/protocol.rb:133:in `sysread': end of file reached  
(EOFError)

I using this code to import list:

file = File.new(list,"r")  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;begin  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while (line = file.gets)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line.chomp!  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iplist.push line  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rescue EOFError  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f.close  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end

Can you help me please?  
Thank you very much

Al

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![David\_A\_Black1](https://avatars.discourse-cdn.com/v4/letter/d/bcef8e/32.png) [@David\_A\_Black1](https://rubytalk.org/u/David_A_Black1)\
**Post date:** [17 July 2008 11:43 UTC](https://rubytalk.org/t/sysread-error/47758/2 "2008-07-17T11:43:34Z")

</div>

Hi --

> **···**
>
> On Thu, 17 Jul 2008, Alfonso Caponi wrote:
> 
> > Hi List,
> > 
> > I wrote a simple script that import a file list of hosts and try to  
> > connect.  
> > Before the end of the file the script exits with this error:
> > 
> > /usr/lib/ruby/1.8/net/protocol.rb:133:in `sysread': end of file reached  
> > (EOFError)
> > 
> > I using this code to import list:
> > 
> > file = File.new(list,"r")  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;begin  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while (line = file.gets)  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line.chomp!  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iplist.push line  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rescue EOFError  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f.close  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
> > 
> > Can you help me please?  
> > Thank you very much
> 
> It looks like the error is in the part of the script where you're  
> connecting to hosts, since it's in the net code.
> 
> David
> 
> --  
> Rails training from David A. Black and Ruby Power and Light:  
> &nbsp;&nbsp;&nbsp;Intro to Ruby on Rails July 21-24 Edison, NJ  
> &nbsp;&nbsp;&nbsp;Advancing With Rails August 18-21 Edison, NJ  
> See [http://www.rubypal.com](http://www.rubypal.com) for details and updates!

---

<div class="post-metadata">

**Author:** ![Alfonso\_Caponi](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@Alfonso\_Caponi](https://rubytalk.org/u/Alfonso_Caponi)\
**Post date:** [17 July 2008 13:45 UTC](https://rubytalk.org/t/sysread-error/47758/3 "2008-07-17T13:45:14Z")

</div>

David A. Black wrote:

> Hi --
> 
> > Can you help me please?  
> > Thank you very much
> 
> It looks like the error is in the part of the script where you're  
> connecting to hosts, since it's in the net code.
> 
> David

This is the complete error:

/usr/lib/ruby/1.8/net/protocol.rb:133:in `sysread': end of file reached  
(EOFError)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/net/protocol.rb:133:in `rbuf\_fill'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/timeout.rb:56:in `timeout'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/timeout.rb:76:in `timeout'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/net/protocol.rb:132:in `rbuf\_fill'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/net/protocol.rb:126:in `readline'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/net/http.rb:1988:in `read\_status\_line'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/net/http.rb:1977:in `read\_new'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;... 6 levels...  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/timeout.rb:56:in `timeout'

> **···**
>
> > On Thu, 17 Jul 2008, Alfonso Caponi wrote:
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
