AS3 FTP规划和插座和ByteArray类 [英] AS3 FTP Programming and the Socket and ByteArray Classes

查看:370
本文介绍了AS3 FTP规划和插座和ByteArray类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉的主题听起来像一个更nerdier哈利·波特称号。

Sorry for the subject line sounding like an even nerdier Harry Potter title.

我想要使用AS3的Socket类编写一个简单的FTP程序我使用的FTP服务器我的本地网络上的测试程序导出为一个AIR应用程序在Flex Builder 3。我可以成功连接到服务器(比较容易的部分),但我不能发送任何指令。我是pretty的肯定,你必须使用ByteArray类发送这些命令,但有信息,我很想念显然有些关键部分。有谁知道如何做到这一点?谢谢! 戴夫

I'm trying to use AS3's Socket class to write a simple FTP program to export as an AIR app in Flex Builder 3. I'm using an FTP server on my local network to test the program. I can successfully connect to the server (the easy part) but I can't send any commands. I'm pretty sure that you have to use the ByteArray class to send these commands but there's some crucial piece of information that I'm missing apparently. Does anyone know how to do this? Thanks! Dave

推荐答案

FTP协议predates UTF编码。切换到ANSI / ASCII更好的结果。如果你选择writeMultiByte代替writeUTFBytes,要知道,这是越野车中的Linux。 下面是它周围的的一种方式。

The FTP protocol predates UTF encoding. Switch to ANSI/ASCII for better results. If you do opt for writeMultiByte instead of writeUTFBytes, be aware that it is buggy in linux. Here's one way around it.

还有一个问题,<一个href="http://stackoverflow.com/questions/285290/trying-to-send-an-http-request-over-sockets">here其中行结束原来是罪魁祸首,所以一定要确保你得到它的权利(如上面的建议)。

There's another question here where the line ending turns out to be the culprit, so make sure that you get it right (as suggested above).

正如前面所说,如果这从网络上运行,所有的套接字连接都需要一个跨域策略,但这不是基于文件的通过HTTP。最近更改安全规则意味着所有基于套接字连接,必须首先从托管在目标主机的端口843的策略服务器跨域。

As said before, if this is running from the web, all socket connections will require a crossdomain policy, but this is NOT file based over HTTP. Recent changes to the security rules mean that any socket based connection must first get a crossdomain from a policy server hosted on port 843 of the target host.

从Adobe报价:

一个SWF文件可能不再做没有套接字策略文件,套接字连接到其自己的域。在此之前版本9,0,115,0,SWF文件被允许进行套接字连接到端口1024或更高版本在自己的领域没有政策文件。

A SWF file may no longer make a socket connection to its own domain without a socket policy file. Prior to version 9,0,115,0, a SWF file was permitted to make socket connections to ports 1024 or greater in its own domain without a policy file.

HTTP策略文件可能不再使用授权套接字连接。在此之前的版本9,0,115,0,HTTP策略文件,从/crossdomain.xml的主位置服务的80端口,可用于授权的套接字连接到任何端口1024或更高版本在同一主机上。

HTTP policy files may no longer be used to authorize socket connections. Prior to version 9,0,115,0, an HTTP policy file, served from the master location of /crossdomain.xml on port 80, could be used to authorize a socket connection to any port 1024 or greater on the same host.

从本质上讲,这是什么意思是,你必须在目标FTP主机的控制权,并在其上​​安装辅助软件来得到这个工作。

Essentially, what this means is that you must be in control of the target FTP host, and install supplementary software on it to get this working.

这篇关于AS3 FTP规划和插座和ByteArray类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆