Project - Stable FTP Server

I have an issue while tyring to upload a file on the server using QnetworkaccessManager (Qt5.8). The server answer Bad sequence of command. It works properly with dos ftp client and filezilla.

I am wondering if the problem is the “/” character (before upload.txt) since it does not exists when I transfer the file using filezilla but don’t know how to delete it since it is required by the qnetworkaccessmanager.

Does anyone have enough skill in network protocol to help me?

We need to develop a new HMI for our customers (previous one was develop with winforms) and now we move to multi OS abilities. As Qftp is deprecated this seems not a good option that’s why we moved to qnetwork access manager.

We succeed to backtrack the error in the ftpdefaultlistener run method of the thread _worker. In fact the context.Request.Method return WebRequestMethods.FTP.UploadFile and therefore a statuscode 451.

I did not study yet deeply the code but I am suprised to not see the the same request method using filezilla…

My feeling is that this is something related to the TYPE of transfert (I or A)… any idea?

It’s fixed the problem was the path given in the qt url (need to add /SD/ between the host ip and the filename…)

Now the problem is the download, Qt ask for the help command that is not implemented. It ry to add it but spend a hard time to make it worked…

I solved the problem of HELP command by adding a fake one and probably solved an issue when openning binary mode data transfert (the message is sent before opening it and some clients start waiting for data while the socket is not created)…not sure

@ cyberhome Inneficient yes but really convenient…

The issue concerning re bind after lost socket is still there…

I confirm. How to solve this problem?

debugging and identifying a code fault and addressing it.
The code, posted 2013, is probably what it is. If you want the thing to work you’re likely to need to roll up the sleeves

Brett, I tested my code for several days and I get an error 10048 every time when disconnecting and reconnecting the cable when the client is connected.

My code

private void SetupServerSocket()
{
    int failedAttempts = 0;
    TryAgain:
    try
    {
        IPEndPoint endPoint = new IPEndPoint(IPAddress.Any, _port);
        _serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        _serverSocket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true);
        _serverSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
        _serverSocket.Bind(endPoint);
        _serverSocket.Listen(10);
    }
    catch (SocketException exc)
    {
        if (exc.ErrorCode == 10048) 
        {
            if (failedAttempts < 100)
            {
                failedAttempts += 1;
                Thread.Sleep(1);
                goto TryAgain;
            }
        }
    }
}

error 10048 when calling _serverSocket.Bind (endPoint);

you’re going to need to look at the source not just your code.

(whether you can do anything about it is a completely different story though - it is pretty much orphaned unless you want it on a generic platform like @Justin’s STM32 Netmf4.4 build…)

I tried stopping the server as soon as the cable was disconnected. and when reconnecting the cable, restart the server. and here I got error 10048.
But I abandoned this method. Now I do not stop the server thread ever. It just sleeps while the cable is unplugged.

perfect - a workaround using the limitations you are handed…

I’ve been trying to find Richard’s “Stable FTP Server” on codeshare or anywhere else on the web without success. Can someone post a link where I can download this code?

Thanks - Gene Massion

this thread is more than 2 years old but may be someone will find a link which is still valid

the main question is .NET Micro Framework or TinyCLR

for TinyCLR for example you could use GHI’s FTP Server Code or the one i have published