Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing error socketException: Connection reset by peer (OS Error: Connection reset by peer, errno = 54) on ios #25

Open
aqueebqazi opened this issue Aug 18, 2023 · 3 comments
Labels
question Further information is requested

Comments

@aqueebqazi
Copy link

Hi
I am facing the above error when uploading multiple files 4to 5 files on ios emulator iphone 14 pro ios v 16.4.
Below is the code
for (int i = 0; i < file.length; i++) {

        // await ftpConnect.connect();

Future.delayed(Duration(seconds: 2),(){
log("delay started");
});
log("delay ended");

        currentIndex = i;
        if (cancelUpload.value == false && isUploadSucess.value == false) {
          log("lenfth of file" + file.length.toString());
          log("current file path:" + file[i].path);
          File files = File(file[i].path);
          log("current file path ---->> :" + files.path);
          log("current file paths before uploading :" +
              tabController1.file.toString());

          await ftpConnect.uploadFile(
            File(file[i].path),
            supportIPV6: false,
          );
          double data1 = fileCount.value.toDouble();
          showFileCount.value = data1.toString();
          //increase the value of file by one when the file is uploaded sucessfully
          //below code is to calculate upload percent
          log("file count" + fileCount.value.toString());
          showUploadPercentage.value = uploadPercent.value;
          //uploading xml file
          String fileName = p.basename(file[i].path).split('.').first;
          // remove extension from file name
          // fileName = fileName.substring(0, fileName.lastIndexOf('.'));
          //faster way

          final myxmlFile = File('$_dirPath/${fileName}.xml');
          log("XML FILE NAME >>>> ${myxmlFile.path}");
          await myxmlFile.writeAsString(document.toXmlString(pretty: true));
          await ftpConnect.uploadFile(myxmlFile);
          fileCount.value++;
          uploadPercent.value =
              (fileCount.value.toDouble() / totalcount) * 100;
          double data = fileCount.value.toDouble();
          showFileCount.value = data.toString();
          log("file count" + fileCount.value.toString());
          log("totalFileCount" + totalFileCount.value.toString());
          log("upload percent" + uploadPercent.value.toString());
          log("above sucess" + uploadPercent.value.toString());
          showUploadPercentage.value = uploadPercent.value;
          // await ftpConnect.disconnect();
          if (showUploadPercentage.value == 100.0) {
            Wakelock.disable();
            isUploadSucess.value = true;
            Fluttertoast.showToast(
                msg: "Successfully Uploaded".tr,
                gravity: ToastGravity.CENTER);

            log("upload was" + isUploadSucess.toString());
          }
        } else if (cancelUpload.value == true) {
          Fluttertoast.showToast(
              msg: "Upload was canceled", gravity: ToastGravity.CENTER);
        }
      }
@aqueebqazi
Copy link
Author

The code works fine on android.

@salim-lachdhaf
Copy link
Owner

the code seems correct for me

@salim-lachdhaf salim-lachdhaf added the question Further information is requested label Feb 25, 2024
@salim-lachdhaf
Copy link
Owner

have you a simple to reproduce the issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants