[mono-android] FTP Upload

Carlos Alberto Cortez calberto.cortez at gmail.com
Thu Feb 23 17:08:21 UTC 2012


Hey,

Would you mind pasting the actual stack trace? There are a pair of possible
reasons, but some details could help a lot to figure out what's happening
;-)

Carlos.

2012/2/23 Natanael <sistemas at lorenzetti.com.br>

> I am with the following error in the command
>
> request.GetRequestStream Stream stream = () // ERROR: Not Connected
>
>
> , the routine below, can someone help me.
>
>
> Uri uri = new Uri(ftpHost + "/" + remoteFilePath);
> FtpWebRequest request = (FtpWebRequest)FtpWebRequest.CreateDefault( uri );
> request.KeepAlive = false;
> request.Method = WebRequestMethods.Ftp.UploadFile;
> request.UsePassive = false;
> request.UseBinary = true;
>
> Stream stream = request.GetRequestStream(); // ERROR: Not Connected
>
> FileStream fileStream = File.OpenRead(localFilePath);
> int Length = 2048; byte[] buffer = new byte[Length];
> int bytesToSend = fileStream.Read(buffer, 0, Length);
>
>    while (bytesToSend > 0)
>    {
>        stream.Write(buffer, 0, bytesToSend);
>        bytesToSend = fileStream.Read(buffer, 0, Length);
>    }
>
> stream.Close();
>
>
> --
> View this message in context:
> http://mono-for-android.1047100.n5.nabble.com/FTP-Upload-tp5507988p5507988.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20120223/d222a88d/attachment.html>


More information about the Monodroid mailing list