Client to telnet into server and then ftp to another server

M

Marlo

Hi

I am trying to write a java client that connects to a ftp server.
The trick is that the ftp server has a private IP and is sitting
behind a Telnet server with a public IP address.

How can I go about implementing this client? [I already have the ftp
client working.].
The idea is first to connect via telnet, then connect to the ftp server
and then download/upload files.

Can I use TelnetInputStream or what other sugesstions do you have?

Thanks,
Marlo
 
C

Chris

Marlo said:
Hi

I am trying to write a java client that connects to a ftp server.
The trick is that the ftp server has a private IP and is sitting
behind a Telnet server with a public IP address.

How can I go about implementing this client? [I already have the ftp
client working.].
The idea is first to connect via telnet, then connect to the ftp server
and then download/upload files.

Can I use TelnetInputStream or what other sugesstions do you have?

Thanks,
Marlo
I haven't done this, but it should theoretically be possible. I'd start
with a telnet client and see if you can feed it text strings and get
responses just as if you were sitting at a telnet terminal. Once you get
that working, just use a command line ftp client on the telnet server.
Download files to the telnet server, and then to the client from there.
Streaming it in one go might be trickier.
 
G

Gordon Beaton

I am trying to write a java client that connects to a ftp server.
The trick is that the ftp server has a private IP and is sitting
behind a Telnet server with a public IP address.

How can I go about implementing this client? [I already have the ftp
client working.]. The idea is first to connect via telnet, then
connect to the ftp server and then download/upload files.

I know this isn't a direct answer to your question, but it might help
you find a better solution to your problem.

It sounds to me like you're trying to transfer files between two
hosts, neither of which is your localhost. It might be worth knowing
that the FTP protocol already supports this kind of transfer, i.e. an
FTP client on one host can be used to transfer files directly between
two other hosts, without the files passing the client host.

All that's required is that the client establish control connections
to each of the remote hosts. It's described in the RFC, in particular
figure 2 and section 5.2.

/gordon
 
M

Marlo

Gordon said:
I am trying to write a java client that connects to a ftp server.
The trick is that the ftp server has a private IP and is sitting
behind a Telnet server with a public IP address.

How can I go about implementing this client? [I already have the ftp
client working.]. The idea is first to connect via telnet, then
connect to the ftp server and then download/upload files.

I know this isn't a direct answer to your question, but it might help
you find a better solution to your problem.

It sounds to me like you're trying to transfer files between two
hosts, neither of which is your localhost. It might be worth knowing
that the FTP protocol already supports this kind of transfer, i.e. an
FTP client on one host can be used to transfer files directly between
two other hosts, without the files passing the client host.

All that's required is that the client establish control connections
to each of the remote hosts. It's described in the RFC, in particular
figure 2 and section 5.2.

/gordon

Thanks for your reply. I came accross this website,
http://www.rfc-archive.org/getrfc.php?rfc=1415, which I think is the
one you were referring to. I am not familiar with the FTAM protocol. So
I will have to really read up on it to determine whether I can
implement this option.

Question : FTAM does not seem like a very popular protocol. How
difficult do you think will it be to program the FTP-FTAM gateway for a
java developer like me, with 1 year's experience? Bearing in mind that
I have less than a month to familiarise myself with this specification
and to code it?
 
G

Gordon Beaton

Thanks for your reply. I came accross this website,
http://www.rfc-archive.org/getrfc.php?rfc=1415, which I think is the
one you were referring to. I am not familiar with the FTAM protocol.
So I will have to really read up on it to determine whether I can
implement this option.

Question : FTAM does not seem like a very popular protocol. How
difficult do you think will it be to program the FTP-FTAM gateway
for a java developer like me, with 1 year's experience? Bearing in
mind that I have less than a month to familiarise myself with this
specification and to code it?

I was referring to regular FTP, and the RFC number (rfc959) got lost
while I was editing my post.

Here it is:
http://www.ietf.org/rfc/rfc959.txt

You mentioned that you'd already implemented an FTP client, so I don't
suppose it should be a great deal of work to use it as described in
section 5.2.

There are also a number of open source FTP client libraries for Java,
(for example http://jakarta.apache.org/commons/net/) so there's really
no need to invent your own.

See also:
http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html

/gordon
 
M

Marlo

Gordon said:
I was referring to regular FTP, and the RFC number (rfc959) got lost
while I was editing my post.

Here it is:
http://www.ietf.org/rfc/rfc959.txt

You mentioned that you'd already implemented an FTP client, so I don't
suppose it should be a great deal of work to use it as described in
section 5.2.

There are also a number of open source FTP client libraries for Java,
(for example http://jakarta.apache.org/commons/net/) so there's really
no need to invent your own.

See also:
http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html

/gordon

Thanks for the link. I'll read through it and then try to integrate my
client.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top