Forum: Ruby on Rails SocketError (getaddrinfo: Name or service not known)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
669c735cf55efa005140fa232b05c4f6?d=identicon&s=25 daociyiyou (Guest)
on 2009-05-12 14:59
(Received via mailing list)
I want write image(thumbnail is binary data) to
ftp://showreelfinder.com/www.showreelfinder.com/web/site/temp/uploads/heywatch
directory. But i got error like following:
####
SocketError (getaddrinfo: Name or service not known)
####
My writing codes like this:
 ####
  ftp_host="ftp://showreelfinder.com"
  ftp=Net::FTP.new(ftp_host,"heywatch","JRnu4bNtXl")
  ftp.login
  ftp.putbinaryfile(thumbnail,"www.showreelfinder.com/web/site/temp/
uploads
  /heywatch"+encoded_video.title)#thumbnail is binary data
  ftp.close
###
  puttextfile(localfile, remotefile = File.basename(localfile)) {|
line| ...},the localfile params can not be  binary data? or
remotefile must exist on ftp server?


Thanks!
1e7782e67bb34c9c67ed19d5cde5f4eb?d=identicon&s=25 Tom Z Meinlschmidt (Guest)
on 2009-05-12 15:10
(Received via mailing list)
remove ftp:// from you ftp_host variable

daociyiyou wrote:
>   ftp.login
> Thanks!
>

--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===============================================================================
669c735cf55efa005140fa232b05c4f6?d=identicon&s=25 daociyiyou (Guest)
on 2009-05-12 18:21
(Received via mailing list)
Thanks. But i got another error:

####
Net::FTPPermError (500 Unknown command. ):
####

So i changed the codes according to my guess:

####
  ftp_host="showreelfinder.com"
  ftp=Net::FTP.new(ftp_host,"heywatch","JRnu4bNtXl")
  ftp.login
  ftp.putbinaryfile(thumbnail,"ftp://showreelfinder.com/
www.showreelfinder.com/web/site/temp/uploads/heywatch/"+encoded_video.title)
  ftp.close
####

I still get the error:

####
Net::FTPPermError (500 Unknown command. ):
####
I want write the binary data(thumbnail) to the ftp address ("ftp://
showreelfinder.com/www.showreelfinder.com/web/site/temp/uploads/
heywatch/"+encoded_video.title),the encoded_video.title file does not
exist on ftp server.
so how do i manage?
1e7782e67bb34c9c67ed19d5cde5f4eb?d=identicon&s=25 Tom Z Meinlschmidt (Guest)
on 2009-05-12 18:28
(Received via mailing list)
ftp.putbinaryfile(thumbnail,"ftp://showreelfinder.com/
www.showreelfinder.com/web/site/temp/uploads/heywatch/"+encoded_video.title)

change to

ftp.putbinaryfile(thumbnail,"/www.showreelfinder.com/web/site/temp/uploads/heywatch/"+encoded_video.title)

tom

daociyiyou wrote:
>   ftp=Net::FTP.new(ftp_host,"heywatch","JRnu4bNtXl")
> ####
> I want write the binary data(thumbnail) to the ftp address ("ftp://
> showreelfinder.com/www.showreelfinder.com/web/site/temp/uploads/
> heywatch/"+encoded_video.title),the encoded_video.title file does not
> exist on ftp server.
> so how do i manage?
>

--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
  - experienced RoR/PHP freelancer, available for hire

   www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===============================================================================
1e7782e67bb34c9c67ed19d5cde5f4eb?d=identicon&s=25 Tom Z Meinlschmidt (Guest)
on 2009-05-12 18:31
(Received via mailing list)
back, your code is wrong

  ftp = Net::FTP.new(ftp_host)
  ftp.login('username','password')
  ftp.chdir('/www.showreelfinder.com/web/site/temp/uploads/heywatch/')
  ftp.putbinaryfile(thumbnail, encoded_video.title)
  ftp.close

tom

daociyiyou wrote:
>   ftp=Net::FTP.new(ftp_host,"heywatch","JRnu4bNtXl")
> ####
> I want write the binary data(thumbnail) to the ftp address ("ftp://
> showreelfinder.com/www.showreelfinder.com/web/site/temp/uploads/
> heywatch/"+encoded_video.title),the encoded_video.title file does not
> exist on ftp server.
> so how do i manage?
>

--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
  - experienced RoR/PHP freelancer, available for hire

   www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===============================================================================
669c735cf55efa005140fa232b05c4f6?d=identicon&s=25 daociyiyou (Guest)
on 2009-05-12 18:38
(Received via mailing list)
I have changed to ftp.putbinaryfile(thumbnail,"/www.showreelfinder.com/
web/site/temp/uploads/heywatch/"+encoded_video.title) and still got
that error.  Then i changed  to

ftp.putbinaryfile(thumbnail,"/www.showreelfinder.com/web/site/temp/
uploads/heywatch/"+encoded_video.title+".jpg")

The same error happend.
669c735cf55efa005140fa232b05c4f6?d=identicon&s=25 daociyiyou (Guest)
on 2009-05-12 19:13
(Received via mailing list)
Thanks.
I have changed the wrong codes but got the third error:
######
Net::FTPPermError (550 Failed to change directory. )
#####
My ftp complete directory is
ftp://showreelfinder.com/www.showreelfinder.com/web/site/temp/uploads/heywatch/
1e7782e67bb34c9c67ed19d5cde5f4eb?d=identicon&s=25 Tom Z Meinlschmidt (Guest)
on 2009-05-12 19:23
(Received via mailing list)
so you have to check the directory manually

I suppose change chdir to web/site/temp/uploads/heywatch ...

tom

daociyiyou wrote:
>>
>> daociyiyou wrote:
>>> www.showreelfinder.com/web/site/temp/uploads/heywatch/"+encoded_video.title)
>>> so how do i manage?
>> --
>> ===============================================================================
>> Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
>>   - experienced RoR/PHP freelancer, available for hire
>>
>>    www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz
>> ===============================================================================
>

--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
 - experienced RoR/PHP freelancer, available for hire

  www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===============================================================================
669c735cf55efa005140fa232b05c4f6?d=identicon&s=25 daociyiyou (Guest)
on 2009-05-13 16:53
(Received via mailing list)
hi Tom
My ftp directory setting is right.ftp api need port to be specified? I
got another error

###
Net::FTPPermError (500 Illegal PORT command. ):
###

My codes is

###
  Net::FTP.open('showreelfinder.com') do |ftp|
    ftp.login('heywatch','JRnu4bNtXk')
    ftp.chdir('thumbnail')
    ftp.putbinaryfile('public/images/rails.png',encoded_video.title)
###

I have tried my best.My server forbids ftp access or my computer
occupied the 21 port?
Ftp really make me like a idiot.


===============================================================================
669c735cf55efa005140fa232b05c4f6?d=identicon&s=25 daociyiyou (Guest)
on 2009-05-13 18:08
(Received via mailing list)
can you help me?
1e7782e67bb34c9c67ed19d5cde5f4eb?d=identicon&s=25 Tom Z Meinlschmidt (Guest)
on 2009-05-13 18:16
(Received via mailing list)
try to set passive mode

daociyiyou wrote:
> ###
>
> ===============================================================================
>

--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
  - experienced RoR/PHP freelancer, available for hire

   www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===============================================================================
669c735cf55efa005140fa232b05c4f6?d=identicon&s=25 daociyiyou (Guest)
on 2009-05-13 18:50
(Received via mailing list)
Thank you very much! After changed to passive mode,it works for normal
image file.But for thumbnail(binary data),i does not.The ftp api does
not support binary data writing? I got the error:No such file or
directory
1e7782e67bb34c9c67ed19d5cde5f4eb?d=identicon&s=25 Tom Z Meinlschmidt (Guest)
on 2009-05-13 20:34
(Received via mailing list)
"I got the error:No such file or directory"

it's not problem with binary mode, but with your file :)

tom

daociyiyou wrote:
>> daociyiyou wrote:
>>>     ftp.chdir('thumbnail')
>>
>>    www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz
>> ===============================================================================
> >


--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
 - experienced RoR/PHP freelancer, available for hire

  www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===============================================================================
669c735cf55efa005140fa232b05c4f6?d=identicon&s=25 daociyiyou (Guest)
on 2009-05-14 02:54
(Received via mailing list)
ftp api itself has binary mode ,but not support the file writing
which itself is initially binary data?
not support binary data writing? I got the error:No such file or
directory
669c735cf55efa005140fa232b05c4f6?d=identicon&s=25 daociyiyou (Guest)
on 2009-05-14 05:09
(Received via mailing list)
ftp api itself has binary mode ,but not support the file writingwhich
itself is initially binary data?
669c735cf55efa005140fa232b05c4f6?d=identicon&s=25 daociyiyou (Guest)
on 2009-05-14 11:16
(Received via mailing list)
hi tom
I have resolved the problem by writing the binary data in the local
file and transfer it to the ftp.
This topic is locked and can not be replied to.