using ftp with Pocket PC CF

S

Scott Brogden

Any body have any luck using ftp from CF. I'm trying to bring in
InternetOpen, InternetConnet, FtpOpenFile and InternetWriteFile using
[ DllImport("wininet.dll", EntryPoint="FtpGetFileW",
CharSet=CharSet.Unicode) ]

public static extern UInt32 InternetOpenW(string sAgent, UInt32 nAccessType,
string sProxy, string sProxyBypass, UInt32 nFlags);

[ DllImport("wininet.dll", EntryPoint="InternetConnectW",
CharSet=CharSet.Unicode) ]

private static extern UInt32 InternetConnectW(UInt32 hInternet, string
ServerName, UInt16 ServerPort, string sUserName, string sPassword, UInt32
nService, UInt32 nFlags, UInt32 Context);



[ DllImport("wininet.dll", EntryPoint="InternetConnectW",
CharSet=CharSet.Unicode) ]

private static extern UInt32 FtpOpenFileW(UInt32 hConnect, string
lpszFileName, UInt32 dwAccess, UInt32 dwFlags, UInt32 dwContext);



[ DllImport("wininet.dll", EntryPoint="InternetWriteFile",
CharSet=CharSet.Unicode) ]

private static extern bool InternetWriteFile(UInt32 hFile, byte[] lpBuffer,
UInt32 dwNumberOfBytesToWrite, Int32 lpdwNumberOfBytesWritten);



See any problems with this. InternetOpen just returns 0. what would
HINTERNET correspond to in C#? Is there a better way of doing this?



Thanks

Scott
 
S

Sarat Venugopal

Hi,
Nothing seems to be wrong. The return value is also valid, indicating a
failure to open the connection. Easier to debug in native mode. I'd just
create a simple Win32 or MFC application to open the connection using the
API, and see what settings succeed. If that fails too, you know it has
nothing to do with P/Invoke. If you tweak the access flags, it should work.
I doubt there is anything fundamentally wrong with WinInet.

HINTERNET is just a handle. UInt32 is okay, but Int32 is preferred -
INVALID_HANDLE_VALUE is -1.

HTH,
Sarat Venugopal
Huelix Solutions
www.huelix.com
 
C

Chris Tacke, eMVP

Also make sure you're not using a PPC 2002 without a service upgrade, or it
can only make anonymous connections.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top