SocketError (getaddrinfo: Name or service not known)


#1

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!


#2

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


#3

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?


#4

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


#5

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.


#6

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


#7

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/


#8

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


#9

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.

===============================================================================


#10

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


#11

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


#12

can you help me?


#13

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


#14

“I got the error:No such file or directory”

it’s not problem with binary mode, but with your file :slight_smile:

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


#15

hi tom
I have resolved the problem by writing the binary data in the local
file and transfer it to the ftp.


#16

ftp api itself has binary mode ,but not support the file writingwhich
itself is initially binary data?