通过 AS3 套接字向我的 FTP 站点发送字节时出现问题
我有一些 as3 代码,可以成功打开 2 个到我的 FTP 服务器的套接字连接。一种用于命令,一种用于数据。我使用 STOR 命令在 FTP 服务器上创建一个文件,然后使用 writeBytes 从 byteArray 发送编码的 jpeg。然后我刷新数据套接字并成功关闭它。
除了 byteArray 长 826 字节而我最终在 ftp 服务器上得到的文件只有 817 字节之外,所有这些似乎都很好,毫不奇怪,该文件不被识别为 jpeg。
有什么想法吗?
I have some as3 code which successfully opens 2 socket connections to my FTP server. One for commands and one for data. I am using the STOR command to create a file on the FTP server and then sending an encoded jpeg from a byteArray using writeBytes. I then flush the data socket and close it successfully.
All of this appears to be fine apart from the fact that the byteArray is 826 bytes long and I end up with a file which is only 817 bytes on the ftp server which not surprisingly isn't recognised as a jpeg.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请不要对此答案 +1,也不要将其标记为正确。我只发布@richarddolsson 和@Kevin 的评论和回答。转到评论并在那里添加优点。我这样做是因为这在搜索中显示为“未答复”。
@richarddolsson - 如果存在“二进制模式”,则将传输配置为使用“二进制模式”(我知道在某些客户端中确实如此)。 0x0D 0x0A 是 Windows 换行序列 (CRLF),我不希望它出现在 JPEG 标头中。
@Kevin - 问题出在模式设置中,应该是 TYPE I 切换到二进制模式,但有一个拼写错误,将其默认回 ASCII。
Please do not +1 this answer, nor mark it as correct. I am only posting the comment and answer from @richarddolsson and @Kevin. Go to the comments and add plusses there. I am doing this because this is showing up as "unaswered" in the searches.
@richarddolsson - Configure the transfer to use "binary mode" if such exists (I know it does in some clients). 0x0D 0x0A is a Windows newline sequence (CRLF) and I wouldn't expect that to be in a JPEG header.
@Kevin - The problem was in the mode setting which should have been TYPE I to switch to binary mode and had a typo which defaulted it back to ASCII.