FTP problems on windows

Discussion in 'Ruby' started by csjasnoch@wisc.edu, Jul 18, 2005.

  1. Guest

    I created a script to send a receive event scripts for a pixord video
    server.
    I created an FTP session class which contains the following def's

    def initialize(ip)
    begin
    @serv = Net::FTP.new(ip)

    @serv.login(user=*****,password =*****)
    #get into Sys dir
    @serv.chdir('Sys')

    rescue
    puts "Invalid IP set. ip set as #{ip}\n"
    end
    end

    def get_curr(filename)



    loadfile = @serv.gettextfile("scr00.txt")#get the event file
    stored
    #in the pixord server

    # change the name of the file to given file name
    File.rename("scr00.txt", filename)


    end

    def put_curr(filename)

    #change name to pixord event name

    begin
    File.rename(filename, "scr00.txt")

    rescue

    puts "file name problem #{filename}\n"

    end
    @serv.puttextfile("scr00.txt")
    end

    #####################

    Everything works fine with my other implimentations (on OSX). However,
    when on a windows machine I can not view anything in the server. The
    connection is being made though.

    To test what was going on I used irb on Windows (I have tried XP and
    2000) and entered the following

    require 'net/ftp'
    ftp = Net::FTP.new(ip)
    ftp.login(user=user_var,password=pass_var)

    #UP TO HERE OK (I think.. no errror or anything)
    ftp.chdir('Sys')

    ftp.gettextfile("scr00.txt") #here is where problem occurs

    ###########END CODE

    When I run from a Mac OSX machine I can access fine, but from the
    windows machines I am getting "Net:FTPTempError 425 Can't Open Data
    Connection"
    I am not exactly sure how to deal with this. If they are on different
    subnets how do I handle this. I am pretty sure the Mac is also but for
    some reason is handling it OK. I am a bit baffled. Any help is
    appreciated. Thanks in advance.

    -Collin
     
    , Jul 18, 2005
    #1
    1. Advertising

  2. Hi,

    In message "Re: FTP problems on windows"
    on Tue, 19 Jul 2005 06:55:56 +0900, writes:

    |I created a script to send a receive event scripts for a pixord video
    |server.
    |I created an FTP session class which contains the following def's

    You might need to use passive mode. Try adding

    @serv.passive = true

    in your code.

    matz.
     
    Yukihiro Matsumoto, Jul 19, 2005
    #2
    1. Advertising

  3. Guest

    Thanks that was it. Just had to set the passive flag to true:)
     
    , Jul 22, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. someone

    FTP over SSL vs FTP over SSH

    someone, Apr 24, 2004, in forum: Java
    Replies:
    1
    Views:
    4,591
    iksrazal
    Apr 25, 2004
  2. Replies:
    3
    Views:
    5,655
  3. Nico Grubert
    Replies:
    0
    Views:
    645
    Nico Grubert
    Nov 24, 2005
  4. D. Buck
    Replies:
    2
    Views:
    492
    D. Buck
    Jun 29, 2004
  5. Replies:
    3
    Views:
    198
    John Mason Jr
    Dec 18, 2004
Loading...

Share This Page