Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
10k views
in .NET FTP by (120 points)
Hi !

i need ftp functionality in my PocketPC app. and i am trying to see if i can translate one of ur examples to the compat framework. I tried with FTPClientTester (before that, i tried the same program as is, and it worked fine).

In the class FTPClient there is this snippet:

public FTPClient(string remoteHost)
{ control = new FTPControlSocket(remoteHost, FTPControlSocket.CONTROL_PORT, null, 0);
}


When this constructor is called , i get the following error:


An unhandled exception of type 'System.MissingMethodException' occurred in FTP.dll

Additional information: Metodo non trovato: get_Out System.Console, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC.


("Metodo non trovato" = "method not found")

When i try to understand which instruction has the error in the code of FTPControlSocket class, i can't even stop the flow of the program with a breakpoint.
I started thinking it is not possible to use this library with CompactFramework. Is it really so ? what could be the problem ?


thankx a lot

Wentu

6 Answers

0 votes
by (162k points)
It looks like System.Console isn't supported (?)

Try commenting out the System.Console stuff, recompile and try again.

Hi !

i get the following error:

An unhandled exception of type 'System.MissingMethodException' occurred in FTP.dll

Additional information: Metodo non trovato: get_Out System.Console, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC.


Wentu
0 votes
by
I am having similar issues.

I was able to make changes and get the DLL to compile.

But the main issue seems to be the BufferedStream.

Compact .NET doesn't have that available.

I tried to change it to just a regular Stream and ran into problems.

Any thoughts?

Phil
0 votes
by (162k points)
We've never used Compact.NET ... sorry we can't help. If anyone has any solution, please post.

I am having similar issues.

I was able to make changes and get the DLL to compile.

But the main issue seems to be the BufferedStream.

Compact .NET doesn't have that available.

I tried to change it to just a regular Stream and ran into problems.

Any thoughts?

Phil
0 votes
by (300 points)
ok I've got some good news for you ;)
I need a FTP client for the .Net CF, so I tried to use edtftp .net.

Here are the little modifications needed to run the client on .net cf:
FTPControlSocket - l109 : Console.out not supported !
- private TextWriter log = System.Console.Out;
+ private TextWriter log = new StreamWriter(@"\ftp.log",true, Encoding.Unicode);


EDIT: the Logout() Method of FTPControlSocket only Flush the TextWriter wich is not enough.
FTPControlSocket - l237 : due to StreamWriter, we need to explicit close the stream (>< Console.out)
   log.Flush();
+ log.Close();
   log = null;


I think this could be a bug in a general environnement. The abstract class TextWriter has to support the close() method. So Close() should be called at the logout. Assign the stream to null is not enough to free the file pointer.

FTPControlSocket - l421 : the local IP of the Pocket PC is rarely a valid IP that supports the resolve method -> direct use of the IP
- IPHostEntry remoteHostEntry = Dns.Resolve(ipAddress);
- IPEndPoint ipe = new IPEndPoint(remoteHostEntry.AddressList[0], port);
+ IPEndPoint ipe = new IPEndPoint(IPAddress.Parse(ipAddress), port);


the last problem is the BufferedStream:
2 solutions:
- Write one by yourself: it's only a stream with a buffer. and stream is supported in the .Net CF
- Use an existing one: for e.g pick up the BufferedStream.cs from Mono Project (look in class\corlib\System.IO\ ) If you use this one you'll need to remove the Localisation part and adapt the argument exception to only 1 argument.

if you need more infos, just ask

maybe the edtftp .net could be compact framework compatible:
I mean you only need a BufferedStream and add some
#if COMPACT_FRAMEWORK
   ....
#else
   ....
#endif




Have fun !

ps: i only tried a couple of transfers till now. so there still could be some errors
0 votes
by (300 points)
another detail:
the pocket pc seems to not provide dns.Resolve() method since most of time it's not connected to the network. It's preferable to use the connection as follows:
FTPClient cli = new FTPClient(System.Net.IPAddress.Parse("10.0.0.1"), 21);


for the .net compact framework all the Resolve() should be used with precaution.
0 votes
by (140 points)
Wavyx,

Would it be possible for you to post a complete (*functioning*) code listing using the edtftp tool and the .net compact framework? I'm trying to implement your workaround and I'm still not clear on what and where to modify.

Thanks!

Categories

...