FTP download code does not work on NAT64 network (testing for Apple store).
I connect my iphone to my mac set as a NAT64 router, run the code below to test the app with IPv6 and I get this error:System.Net.WebException: Cannot open passive data connection.
//Create A 2MB Cache Buffer
byte Buffer = new byte;
int FileLenght = 0;
//Create An FTP Client Request
FtpWebRequest Request = (FtpWebRequest)WebRequest.Create(FTP);
Request.Method = WebRequestMethods.Ftp.DownloadFile;
//Use A Login Credential
//Request.Credentials = new NetworkCredential("USER", "PASS");
//Receive An Answer From Server
FtpWebResponse Response = (FtpWebResponse)Request.GetResponse();
Stream ResponseStream = Response.GetResponseStream();
//Write The File To The SDCARD
StreamWriter Output = new StreamWriter(Local, false);
//Store On Buffer And Write TO SDCARD
while ((FileLenght = ResponseStream.Read(Buffer, 0, Buffer.Length)) > 0)
for (int i = 0; i < FileLenght; i++)
//Close File Stream Writer
//Close Connection Request
The error only happen with NAT64 network, I tested the NAT64 network with the same code on an android device and other apps on the market with success.
Hi, I could successfully reproduce this issue with the following versions of our products: https://gist.github.com/VincentDondain/4edea68e968b73cd3f7c6deb5b10e6d4
To do that I created this sample app: https://www.dropbox.com/s/ptgb09wpn7hdag3/Bug44025.zip?dl=0 (it's using a dummy ftp that you can access and tries to download a readme file).
To simulate a NAT64 network I used this guide (section "Test for IPv6 DNS64/NAT64 Compatibility Regularly") https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html
Here is the exception we're getting: https://gist.github.com/VincentDondain/32515f43df9894f3d6a5878ca5f89454 [on (FtpWebResponse)request.GetResponse ()]
Full build logs: https://gist.github.com/VincentDondain/910c49022d770cd1f00a337ef7a38f34
Because of this issue my app has been rejected by apple and I have my customer asking when the app will be released? Do we have an ETA for this bug fix? or failing that could you just let me know what are the next steps likely to be?
This is not a trivial issue in the BCL. I cannot give you any information with regard to when this will be fixed.
I'd recommend you use the native APIs in order to submit your app (NSUrlConnection and NSUrlDownload in the case of iOS).
I implemented the BCL support in this PR: https://github.com/mono/mono/pull/3762
Merged to mono master and mono-4.8.0-branch. Thanks!
QA: XI/XM won't have the fix available to confirm before https://github.com/xamarin/xamarin-macios/pull/991 is merged.
QA: https://github.com/xamarin/xamarin-macios/pull/991 did the bump so any package after 84e9975e41f48e2444d233eda64112377856276c can be used to test
I am also able to reproduce this issue, after following Comment 1, with X.iOS 10.0.0.3, application throws System.Net.WebException.
Here is the screencast for the same: https://www.screencast.com/t/WjKFWUkI
I connect my iphone to my mac set as a NAT64 router and observed that application is launched and running successfully on iOS device with C9 X.iOS 10.4.0.105 & Master X.iOS 10.5.0.424
Hence closing this issue.