# Bad file descriptor - connect(2) (Errno::EBADF)

**URL:** <https://www.ruby-forum.com/t/bad-file-descriptor-connect-2-errno-ebadf/137186>\
**Category:** Ruby\
**Created:** [May 9, 2008, 7:39pm UTC](https://www.ruby-forum.com/t/bad-file-descriptor-connect-2-errno-ebadf/137186 "2008-05-09T19:39:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hollingv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ecd19e/32.png) [@hollingv](https://www.ruby-forum.com/u/hollingv)\
**Post date:** [May 9, 2008, 7:39pm UTC](https://www.ruby-forum.com/t/bad-file-descriptor-connect-2-errno-ebadf/137186/1 "2008-05-09T19:39:21Z")

</div>

I am using Ruby to send files to an FTPS site. This was working  
perfectly until a week ago, now I get the following error:

c:/ruby/lib/ruby/1.8/net/ftp.rb:159:in `initialize’: Bad file descriptor

- connect(2) (Errno::EBADF)  
from c:/ruby/lib/ruby/1.8/net/ftp.rb:159:in `open_socket' from c:/ruby/lib/ruby/gems/1.8/gems/ftpfxp-0.0.4/lib/ftpfxp/ftpfxptls.rb:281:in`transfercmd’  
from c:/ruby/lib/ruby/1.8/net/ftp.rb:470:in `storlines' from c:/ruby/lib/ruby/1.8/monitor.rb:229:in`synchronize’  
from c:/ruby/lib/ruby/1.8/net/ftp.rb:468:in `storlines' from c:/ruby/lib/ruby/1.8/net/ftp.rb:573:in`puttextfile’  
from ip\_ecsprocess.rb:48  
from ip\_ecsprocess.rb:43  
from c:/ruby/lib/ruby/site\_ruby/1.8/dbi/dbi.rb:823:in `fetch’  
from ip\_ecsprocess.rb:18

I have seen some posts about this problem but still can’t find a fix for  
my code. Is this an environmental problem? Could a microsoft patch on  
the server cause this problem?  
Any help is greatly appreciated.
