简体   繁体   English

在同一窗口中在telnet和ftp连接之间切换

[英]Switching between telnet and ftp connections in the same window

HI my job is to fetch some files thro telnet and ftp protocols, I am just using command prompt to type the commands 嗨,我的工作是通过telnet和ftp协议获取一些文件,我只是使用命令提示符键入命令

I would usually login to telnet and type the telnet commands thro 1 command prompt window. 我通常会登录telnet并通过1命令提示符窗口键入telnet命令。 For executing ftp commands i would create a new command prompt window. 为了执行ftp命令,我将创建一个新的命令提示符窗口。

My question here is 我的问题是

Is there a way by which i could execute telnet and ftp commands in the same window. 有没有一种方法可以在同一窗口中执行telnet和ftp命令。 I am finding an option MULTINET in telnet help .will this serve this purpose? 我在telnet帮助中找到了MULTINET选项。这是否可以达到目的?

If available, can the same procedure be used in C# telnet fetching operations using tcpclient by sending appropriate commands? 如果可用,是否可以通过发送适当的命令在使用tcpclient的C#telnet提取操作中使用相同的过程?

Assuming 2nd qn is possible? 假设第二个qn是可能的? in this scenario how to handle the ending of ftp and telnet sessions (ie relogin scenarios) ? 在这种情况下,如何处理ftp和telnet会话的结束(即重新登录情况)?

I assume that you want to pull the files to the local PC using FTP. 我假设您想使用FTP将文件拉到本地PC。 Otherwise you could push them from the remote server inside your telnet session. 否则,您可以在telnet会话中将它们从远程服务器中推送。

One way you can do this is to escape your telnet session then try to run external ftp commands from your telnet client. 一种方法是退出telnet会话,然后尝试从telnet客户端运行外部ftp命令。 Once the ftp command is done you can return to your telnet session. ftp命令完成后,您可以返回到telnet会话。 This assumes that your telnet client can run external commands. 假设您的telnet客户端可以运行外部命令。

When you open a telnet session you will see something like: 当您打开telnet会话时,您将看到类似以下内容:

Escape character is '^]'.

When you press the escape character (Control ]) you escape the telnet session. 当您按转义字符(控制)时,您将退出telnet会话。 It is still open but depending on the telnet client you can interact with your local PC. 它仍然处于打开状态,但是取决于telnet客户端,您可以与本地PC进行交互。

On most Unix clients you can invoke a command in a subshell by prefixing the command with an exclamation mark: 在大多数Unix客户端上,您可以在子shell中通过在命令前加上感叹号来调用命令:

!ftp

Once the FTP command is done you can return to the telnet session. 完成FTP命令后,您可以返回telnet会话。

Telnet and FTP are two different protocols that run on different ports. Telnet和FTP是在不同端口上运行的两种不同协议。 So you can create a C# program that issues telnet commands to one port (typically port 23) and the same program can also send FTP commands to another port (typically ports 20 and 21). 因此,您可以创建一个将telnet命令发布到一个端口(通常是端口23)的C#程序,并且同一程序还可以将FTP命令发送到另一个端口(通常是端口20和21)。 The telnet and FTP sessions are separate so you need to manage them separately. telnet和FTP会话是分开的,因此您需要分别管理它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM