Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

problem sending bytes through an AS3 Socket to my FTP site

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?

like image 587
Kevin Avatar asked Aug 27 '11 09:08

Kevin


1 Answers

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.

like image 120
iND Avatar answered Sep 18 '22 18:09

iND