I have a problem for days and I can not resolve it. I installed a java routine for ftp in xamarin and it works perfectly since the usb cable (used for debugging) is connected (note and smart) ie if I open xamarin and run in debug mode the routine works perfectly. If I shoot the cable and run the application on my cell phone, the routine writes a piece of the image but it does not return. I generated a release and it also writes a piece of the image and the routine does not return.
Would anyone know what's going on?
below the code for ftp
public void sendAPicture(byte[] picture, int _cdn_stb, string _imb_prt_mnu)
{
string _cds_stb = _cdn_stb.ToString("0000");
string ftpUser = "sasasas";
string ftpPassword = "sasasas";
string ftpfullpath = "ftp://www.meusite.com.br/wordpress/imagens/" + _cds_stb + "/" + _imb_prt_mnu; ;
FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpfullpath));
//userid and password for the ftp server
ftp.Credentials = new NetworkCredential(ftpUser, ftpPassword);
ftp.KeepAlive = true;
ftp.UseBinary = true;
ftp.UsePassive = true;
ftp.Method = WebRequestMethods.Ftp.UploadFile;
ftp.ContentLength = picture.Length;
Stream ftpstream = ftp.GetRequestStream();
var grava = new Task(() =>
{
ftpstream.Write(picture, 0, picture.Length);
});
grava.Start();
grava.Wait(TimeSpan.FromSeconds(10));
ftpstream.Close();
}