Archived Forum Post

Index of archived forum posts

Question:

PutFileAsync WinRT socket shutdown

Nov 20 '15 at 14:34

I'm getting a strange error from win8.1 when uploading file using PutFileAsync method. Im using the WinRT example (http download) and using ftp download a .net app that works fine. Seems I'm good up until this point "WinRT socket shutdown.." I'm intentionally using implicit per my network requirements. Sometimes I get a few bytes, mostly 0 byte file shows up on server. I've tried setting ftp.AutoXcrc = false; and it still fails. I'm using https://www.chilkatsoft.com/downloads_WinRT.asp sample.

settings... (hostname, username, password all set also) ftp.Passive = false; ftp.AuthTls = false; ftp.AuthSsl = false; ftp.AutoFix = false; ftp.Port = 990; ftp.Ssl = true;

Log.....

ChilkatLog:
PutFile(61110ms):
DllDate: Aug 31 2015
ChilkatVersion: 9.5.0.52
UnlockPrefix: <have but hidden>
Username: WinPhone:
Architecture: Little Endian; 64-bit
VerboseLogging: 1
LocalFilename: C:\Users\ecp\AppData\Local\Packages\9909ec1f-b593-4dc0-9e12-edcb7ea9ccd7_4bha6t8v6mmqe\LocalState\hamlet.zip
RemoteFilename: hamlet.zip
ProgressMonitoring:
  enabled: yes
  heartbeatMs: 0
  sendBufferSize: 65536
--ProgressMonitoring
IdleTimeoutMs: 60000
ReceiveTimeoutMs: 60000
ConnectTimeoutSeconds: 120
uploadFromLocalFile(61110ms):
  localFileSize: 78371
  uploadFromDataSource(61110ms):
    initialGreeting: 220 You are accessing a secure site.  All connections are fully audited.
    restartNext: 0
    modeZ: 0
    binaryMode: 1
    pbsz_protp:
      simpleCommand:
        sendCommand:
          sendingCommand: PBSZ 0
        --sendCommand
        readCommandResponse:
          replyLineQP: 200 PBSZ command successful.
          commandResponse: 200 PBSZ command successful.
          statusCode: 200
        --readCommandResponse
      --simpleCommand
      simpleCommand:
        sendCommand:
          sendingCommand: PROT P
        --sendCommand
        readCommandResponse:
          replyLineQP: 200 PROT command successful.
          commandResponse: 200 PROT command successful.
          statusCode: 200
        --readCommandResponse
      --simpleCommand
    --pbsz_protp
    setupDataConnection:
      active transfer mode
      setupActiveDataSocket:
        Using ephemeral port range for Active data connection.
        ckrtBind:
          chosenPort: 31980
        --ckrtBind
        dataPort: 31980
        portIpAddress: 10.192.50.18
        MyIPv4: 10,192,50,18,124,236
        sendCommand:
          sendingCommand: PORT 10,192,50,18,124,236
        --sendCommand
        readCommandResponse:
          replyLineQP: 200 PORT command successful.
          commandResponse: 200 PORT command successful.
          statusCode: 200
        --readCommandResponse
        PortCmd: Elapsed time: 0 millisec
      --setupActiveDataSocket
    --setupDataConnection
    sendUploadCommand:
      sendCommand:
        sendingCommand: STOR hamlet.zip
      --sendCommand
    --sendUploadCommand
    completeDataConnection:
      acceptDataConnection:
        acceptNextConnectionHB:
          acceptNextConnection:
            Setting SO_SNDBUF size
            sendBufSize: 262144
          --acceptNextConnection
        --acceptNextConnectionHB
        Data connection accepted.
        AcceptDataConnection: Elapsed time: 0 millisec
      --acceptDataConnection
    --completeDataConnection
    Reading intermediate response for upload...
    readCommandResponse:
      replyLineQP: 125 Data connection already open; Transfer starting.
      commandResponse: 125 Data connection already open; Transfer starting.
      statusCode: 125
    --readCommandResponse
    intermediateResponseStatusCode: 125
    intermediateReply: 125 Data connection already open; Transfer starting.
    convertDataConnToSsl:
      convertToTls:
        Clearing TLS client certificates.
        clientHandshake:
          The client cert chain is NULL.
          cacheClientCerts:
            Cached TLS client certificates.
            Client cert chain is NULL.
          --cacheClientCerts
          clientHandshake2:
            readHandshakeMessages:
              processHandshakeRecord:
                processHandshakeMessage:
                  processServerHello:
                    MajorVersion: 3
                    MinorVersion: 3
                    cipherSuite: TLS_RSA_WITH_AES_256_CBC_SHA256
                    cipherSuiteNumeric: 00,3d
                    compressionMethod: 0
                    minAcceptableRsaKeySize: 1024
                  --processServerHello
                --processHandshakeMessage
              --processHandshakeRecord
            --readHandshakeMessages
          --clientHandshake2
        --clientHandshake
        Secure Channel Established.
      --convertToTls
      ConvertToTls: Elapsed time: 0 millisec
    --convertDataConnToSsl
    sendUploadFileData(16ms):
      sendBufferSize: 65536
      Sending uncompressed...
      lastBytesSent: 0000010001005A000000B33101000000
      UploadData: Elapsed time: 16 millisec
    --sendUploadFileData
    closingDataConnection:
      shutdownChannel:
        (bForceClose) WinRT socket shutdown..
        terminateConnection:
          Terminated WinRT socket connection.
        --terminateConnection
        Clearing TLS client certificates.
      --shutdownChannel
    --closingDataConnection
    Reading final response...
    readCommandResponse(61094ms):
      idleTimeoutMs: 60000
      tlsReadIncoming: Socket operation timeout.
      Failed to receive more TLS applicaton data.
      recvUntilMatch: Socket operation timeout.
      nReceived: 0
      Failed to read FTP control channel reply.
      readFtpReply: Socket operation timeout.
    --readCommandResponse
    FinalReply: Elapsed time: 61094 millisec
    uploadRate: 1282
    cumulativeNumBytesSent: 78371
  --uploadFromDataSource
  Failed.
--uploadFromLocalFile
TotalTime: Elapsed time: 61110 millisec
Failed.

--PutFile --ChilkatLog


Answer

I released version 9.5.0.54 just now. (at https://www.chilkatsoft.com/downloads_WinRT.asp) Check to see if that changes anything..


Answer

I get an unhandled exception when attempting the ftp2's PutFileAsync or MPutFilesAsync on this latest build 9.5.0.54. It connects, changes directory, verifies connected, then throws unhandled exception (PutFileAsync). Might not be it but if I'm setting a username, why is lasterrortext showing WinPhone: as the username? "Username: WinPhone:rn "

ChilkatLog:\r\n   
PutFile:\r\n    
DllDate: Nov  3 2015\r\n    
ChilkatVersion: 9.5.0.54\r\n    
UnlockPrefix: <here but="" hidden="">\r\n    
Username: WinPhone:\r\n    
Architecture: Little Endian; 64-bit\r\n    
VerboseLogging: 0\r\n   
LocalFilename: C:\\Users\\ecp\\AppData\\Local\\Packages\\9909ec1f-b593-4dc0-9e12-edcb7ea9ccd7_4bha6t8v6mmqe\\LocalState\\hamlet.zip\r\n    
RemoteFilename: hamlet.zip\r\n    
ProgressMonitoring:\r\n      
enabled: yes\r\n      
heartbeatMs: 0\r\n      
sendBufferSize: 65536\r\n    
--ProgressMonitoring\r\n    
IdleTimeoutMs: 60000\r\n    
ReceiveTimeoutMs: 60000\r\n    
ConnectTimeoutSeconds: 30\r\n    
uploadFromLocalFile:\r\n      
localFileSize: 78371\r\n      
uploadFromDataSource:\r\n        
initialGreeting: 220 You are accessing a secure site.  All connections are fully audited.\r\n        restartNext: 0\r\n        
modeZ: 0\r\n        
binaryMode: 1\r\n        
pbsz_protp:\r\n          
simpleCommand:\r\n            
sendCommand:\r\n              
prepControlChannel:\r\n                
LoadAsync returned error AsyncStatus.\r\n              
--prepControlChannel\r\n              
sendingCommand: PBSZ 0\r\n            
--sendCommand\r\n            
readCommandResponse:\r\n              
LoadAsync returned error AsyncStatus.\r\n              
idleTimeoutMs: 60000\r\n              
Failed to receive more TLS applicaton data.\r\n              
Failed to receive more bytes.\r\n              
Failed to read FTP control channel reply.\r\n            
--readCommandResponse\r\n          
--simpleCommand\r\n        
--pbsz_protp\r\n      
--uploadFromDataSource\r\n      
Failed.\r\n    
--uploadFromLocalFile\r\n    
TotalTime: Elapsed time: 0 millisec\r\n    
Failed.\r\n  
--PutFile\r\n
--ChilkatLog\r\n`

Answer

sorry, I had to grab the last error text from VS debugger after unhandled was thrown. I forgot to put it in pre tags. I think the LoadAsync is maybe throwing the unhandled?


Answer

Any idea why this new build is throwing the unhandled exception?


Answer

I'm not getting any unhandled exception. Here's the sample program I'm using for testing (see below).

Are you sure of the source of the exception? Could the exception be coming from your application code and not from within the Chilkat component? It seems that if you're getting the full contents of the LastErrorText, then the PutFile method completed. If it somehow crashed inside PutFile, you would not get the LastErrorText...

        private async void testFtpUpload()
        {
            Chilkat.Ftp2 ftp = new Chilkat.Ftp2();

bool success = ftp.UnlockComponent("xxx");

ftp.Hostname = "192.168.1.137";
            ftp.Username = "chilkat";
            ftp.Password = "xxx";
            ftp.Ssl = true;

success = await ftp.ConnectAsync();
            if (success != true)
            {
                textBox1.Text += "Failed!\r\n" + ftp.LastErrorText;
                return;
            }

Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;

//  Download a .zip from chilkatsoft.com
            string localFilePath = localFolder.Path + @"\hamlet.xml";

success = await ftp.PutFileAsync(localFilePath, "h.xml");
            if (success != true)
            {
                textBox1.Text += "Failed!\r\n" + ftp.LastErrorText;
                return;
            }

success = await ftp.DisconnectAsync();

textBox1.Text += ftp.LastErrorText;
            return;

}