Problem writing to file using code from FTPSDemo found here | Telit Cinterion IoT Developer Community
September 3, 2019 - 2:35pm, 781 views
Hello,
I am having trouble downloading files from an FTP/FTPS Server to an EHS5T-Module.
The code i am using for this is basically the same as the one seen in the FTPSDemo (https://iot-developer.thalesgroup.com/showcase/java-explicit-ftps-implementation-bouncycastle) by Bartłomiej Tyburski.
The problem is that i always get an IOException:
ex=java.io.IOException: IOError -149 during socket:: write
What does -149 mean ?
The file itself is written properly and contains exactly the contents it should have (same size, same contents as on the server...).
I'd just like to know how to deal with this Exception since ignoring every kind of IOException is no viable way to solve this problem...
I tried googling it but it seems that I'm the only one struggling with this problem...
Please help me out with solving this problem or at least give me a nudge into the right direction!
Thanks and Best Regards,
Bogdan
Hello
This exception comes from the module's socket implementation. The description is 'Remote peer has closed the connection'. This might suggest that the server might have closed the connection improperly while or before the module was still trying to send something. There might be probably different reasons for this. One, but not only, would be some incompatibility in FTP protocol implementations (the one in the example is just a simple example).
One of the questions to ask is on which of the 2 connections it was thrown (control or data). Maybe the analysis of a communication on the control channel or TCP trace would shed some more light on this. The good thing is that the file was transferred. It this exception comes from the control channel the only thing you can do is to close the connection. If it comes from the data channel after file transfer you can keep the communication on the control channel if still needed. Anyway your application ***** to provide that every connection is closed each time, also in case of axceptiopn.
Best regards,
Bartłomiej