Go Back   Northcode Support > SWF Studio Plugin Development
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 2006-12-19, 03:30 PM   #1
imaginator_biit
Registered User
 
Join Date: Nov 2006
Location: bochum
Posts: 24
which internet flag need to use

HI Guys


DO any body know which ftp flag need to use for FtpOpenFile function so that we can use return handle for InternetWriteFile to write chunks of data in a file on server.

i tried

INTERNET_FLAG_TRANSFER_BINARY

and

FTP_TRANSFER_TYPE_BINARY

but with both of them file transfered completely, but when i download this file and try to open its not opening. size of file is same as it was on local system.

so it means complete file is uploaded and again downloaded but some thing happend bad some where that i cant understand where. which flag Northcode people have used for FtpOpenFile for InternetWriteFile and InternetReadFile.

with simple text files its working perfectly but not with all other files those contains pictures etc.

please write back as soon as possible,

thanking u in advance

best regards
imaginator_biit is offline   Reply With Quote
Old 2006-12-19, 03:46 PM   #2
Dan
Registered User
 
Dan's Avatar
 
Join Date: May 2003
Location: Ottawa
Posts: 416
Those two flags are actually the same value (see WinInet.h), but for clarity, you probably should use FTP_TRANSFER_TYPE_BINARY .

Might I suggest you start your debugging with some small files (e.g 10-20 characters), and only write a few bytes at a time. View them in a binary editor/viewer. Microsoft Visual Studio does this, if you tell it to open it as a binary file. I'll bet that you'll find that your code is munging parts of the file. For example, opening the local file in text mode is a really bad thing.
Dan is offline   Reply With Quote
Old 2006-12-19, 04:05 PM   #3
imaginator_biit
Registered User
 
Join Date: Nov 2006
Location: bochum
Posts: 24
Hi

I am opening file with binary mode. following is code
Code:
fstream reader;	

reader.open (cFileName.c_str(),ios::in|ios::binary);
reader.seekg (0,ios::beg);

errMsg = myFtp.ftpFileOpen(fileName);// function will create a static HINTERNET Handle of FtpOpenFile.

		if(errMsg=="NOERROR"){
		int counter = 0;
		while(!reader.eof()){
			
			reader.read(buffer, (sizeof(buffer)-1));
			counter = reader.gcount();
			string data( buffer,counter);
			dSize = (DWORD)counter;
			errMsg = myFtp.PutOnFtpServer(data,fileName,dSize);
		    		       
	     }// end of first while		
myFtp.closeHandle();// will close FtpOpenFile created HINTERNET Handle.
then again gives a outer loop which will check for next file and do all these steps again.

i am surprised why its working with simple text file and not working with other files like .doc, .pdf or .jpg etc.

do u have any other idea.

i dont know how can i debugg this project. i am writing a DLL and then loading this DLL in swf studio to check functionality. Still now i used messageboxes to check whats happning . its too bad approch, but i dont know how to debugg this project.

any how any further help??

i m waiting

best regards
imaginator_biit is offline   Reply With Quote
Old 2006-12-19, 04:18 PM   #4
Dan
Registered User
 
Dan's Avatar
 
Join Date: May 2003
Location: Ottawa
Posts: 416
Instead of copying your plugin into the Plugins folder and selecting it in your project, load the plugin dynamically.

Put a call to ssCore.Plugins.loadFromFolder() in your SWF (with the 3 relevant parameters). Build your EXE. If you used startdir:// as the path, copy the EXE to your debug folder. Tell Visual Studio to launch you EXE, and voila, you're debugging.

This is a much more civilized way of doing things.
Dan is offline   Reply With Quote
Old 2006-12-19, 04:43 PM   #5
imaginator_biit
Registered User
 
Join Date: Nov 2006
Location: bochum
Posts: 24
Hi

Okay i am copying ssCore.Plugins.loadFromFolder() in my Actionscript file where i already have these commands.


ssCore.init();
ssCore.Plugins.loadFromFolder();
ssDefaults.synchronousCommands = true;

But which 3 relevant parameters should i give.???

i really did not get what do u mean. i m new with swf studio

can i find this command somewhere in help from swf studio??


did u see my code that i have pasted in last mail. is there any error???

best regards
imaginator_biit is offline   Reply With Quote
Old 2006-12-19, 05:50 PM   #6
imaginator_biit
Registered User
 
Join Date: Nov 2006
Location: bochum
Posts: 24
Y its so??

Hi,

I tried with all files, small and larg but its not working. Even i tried to upload whole file in single chunk of data by creating a big buffer. it uploads correctly but when i download this file then its not opening.

for identifying error in my code i used some external FTP Clients for downloading file. they download file correctly but i cant open it.

It means error is some where in my InternetWriteFile function.

strang is that its uploading complete file. i check size of file uploaded on FTP server its exectly same but why i cant open it???


Dan u told me last time that i should make a function where i shall call FtpOpenFile function which will return a handle that i can use during InternetWriteFile function. I do that in same why. now first of all i call a function which will create Handle, Then i read a chunks of data and write on FTP Server file with InternetWriteFile function.

When file is finished then i close handle.

Every thing seems to correct. Then y file is not openable. or images show now preview when i download them.

do any body have any Idea???

Waiting for your responce

Best regards
imaginator_biit is offline   Reply With Quote
Old 2006-12-20, 05:23 AM   #7
northcode
Tim
 
northcode's Avatar
 
Join Date: May 2001
Location: Ottawa
Posts: 11,874
I would strongly suggest that you try to get your code working as a normal Windows EXE before you try and build it as a plugin for SWF Studio. That will help rule out the plugin architecture as part of your problem. It doesn't sound like the plugin architecture is really what's holding you back. If you can't write an application to handle FTP upload/download operations outside SWF Studio then you're probably not going to have better luck getting it to work as a plugin.
northcode is offline   Reply With Quote
Old 2006-12-20, 06:24 AM   #8
imaginator_biit
Registered User
 
Join Date: Nov 2006
Location: bochum
Posts: 24
Hi

Thanks Tim,

I shall try again to configur debug mode. I really dont know how to do. but i shall get it.

For above mentioned problem , i got solution. there was an error. i readed file and store data in char* buffer and then i create a string and initialize it with buffer.

That was failure. Binary data is not working fine with strings or string cant hold binary data. whatever?

i change my code and now i am sending same char *buffer which contain data, that was readed from file to upload and now its uploading perfectly. all kinds of files are working with now.


Any how thanks again for your cooperation.

Wishing u all happy x-mas.

Best regards
imaginator_biit is offline   Reply With Quote
Old 2006-12-20, 11:03 AM   #9
Dan
Registered User
 
Dan's Avatar
 
Join Date: May 2003
Location: Ottawa
Posts: 416
Regarding the loadFromFolder call. There was a typo in post. It should be "Plugin" not "Plugins".

The parameters I was referring to are in the docs, so rather than try and explain them all here, I'll point you to them; see ssCore.Plugin.loadFromFolder(). The example at the bottom should do the trick.
Dan is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes