I'm trying to use active FTP with Chilkat. Here is the Output from a working FTP-Client (FlashFXP):
SYST
215 UNIX Type: L8
REST 100
350 Restarting at 100. But we're in ASCII mode
REST 0
350 Restarting at 0
PWD
257 "/" is your current location
PROT P
200 Data protection level set to "private"
Listening on PORT: 54131, Waiting for connection.
PORT 192,110,130,33,211,115
500 I won't open a connection to 192.110.130.33 (only to 80.130.210.228)
PORT 80,130,210,228,211,115
200 PORT command successful
LIST -al
150 Connecting to port 54131
TLSv1.2 negotiation successful...
TLSv1.2 encrypted session using cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)
226-Options: -a -l
226 12 matches total
List Complete: 974 bytes in 0,37 seconds (1,0 KB/s)
The interesting part is:
Listening on PORT: 54131, Waiting for connection.
PORT 192,110,130,33,211,115
500 I won't open a connection to 192.110.130.33 (only to 80.130.210.228)
PORT 80,130,210,228,211,115
200 PORT command successful
the client binds a port on my internal ip. Then its using that port with my external ip (my router is forwarding all requests to my internal ip).
all is working fine that way.
now to Chilkat FTP2: i cannot get it working with active mode :)
snipped from my code:
put_Passive(false);
put_Hostname(...);
put_Username(...);
put_Password(...);
put_Port(990);
put_HeartbeatMs(200);
put_SendBufferSize(4096);
put_AuthTls(true);
put_Ssl(false);
put_ForcePortIpAddress("80.130.210.228");
// explicit ssl !
put_AutoFix(false);
Connect();
GetDirCount();
but GetDirCount() is failing:
ChilkatLog:
GetDirCount:
DllDate: Mar 14 2016
ChilkatVersion: 9.5.0.56
UnlockPrefix: INGENIFTP
Username: PC-MARCO:Marco
Architecture: Little Endian; 32-bit
Language: Visual C++ 10.0 (32-bit)
VerboseLogging: 0
listPattern: *
fetchDirListing:
pattern: *
supportsMLSD: 1
fetchDirListing2:
pbsz_protp:
simpleCommand:
sendCommand:
sendingCommand: PBSZ 0
--sendCommand
readCommandResponse:
replyLineQP: 200 PBSZ=3D0
--readCommandResponse
--simpleCommand
simpleCommand:
sendCommand:
sendingCommand: PROT P
--sendCommand
readCommandResponse:
replyLineQP: 200 Data protection level set to "private"
--readCommandResponse
--simpleCommand
--pbsz_protp
setupDataConnection:
active transfer mode
setupActiveDataSocket:
Using ephemeral port range for Active data connection.
SocketError: WSAEADDRNOTAVAIL Cannot assign requested address.
Socket bind failed.
Failed to bind socket.
--setupActiveDataSocket
Failed to setup active data socket.
Try using passive mode instead.
--setupDataConnection
Failed to setup data connection for dir listing.
readRepliesAfterFailedDataConn:
readCommandResponse:
idleTimeoutMs: 1000
tlsReadIncoming: Socket operation timeout.
Failed to receive more TLS applicaton data.
Failed to read FTP control channel reply.
readFtpReply: Socket operation timeout.
--readCommandResponse
--readRepliesAfterFailedDataConn
--fetchDirListing2
--fetchDirListing
N: -1
Failed.
--GetDirCount
--ChilkatLog
i think he tries to bind the port to my external ip. but this wont work. here a log without put_ForcePortIpAddress();
ChilkatLog:
GetDirCount:
DllDate: Mar 14 2016
ChilkatVersion: 9.5.0.56
UnlockPrefix: INGENIFTP
Username: PC-MARCO:Marco
Architecture: Little Endian; 32-bit
Language: Visual C++ 10.0 (32-bit)
VerboseLogging: 0
listPattern: *
fetchDirListing:
pattern: *
supportsMLSD: 1
fetchDirListing2:
pbsz_protp:
simpleCommand:
sendCommand:
sendingCommand: PBSZ 0
--sendCommand
readCommandResponse:
replyLineQP: 200 PBSZ=3D0
--readCommandResponse
--simpleCommand
simpleCommand:
sendCommand:
sendingCommand: PROT P
--sendCommand
readCommandResponse:
replyLineQP: 200 Data protection level set to "private"
--readCommandResponse
--simpleCommand
--pbsz_protp
setupDataConnection:
active transfer mode
setupActiveDataSocket:
Using ephemeral port range for Active data connection.
dataPort: 54517
portIpAddress: 192.110.130.33
MyIPv4: 192,110,130,33,212,245
sendCommand:
sendingCommand: PORT 192,110,130,33,212,245
--sendCommand
readCommandResponse:
replyLineQP: 500 I won't open a connection to 192.110.130.33 (only to 80.130.210.228)
--readCommandResponse
--setupActiveDataSocket
Failed to setup active data socket.
Try using passive mode instead.
--setupDataConnection
Failed to setup data connection for dir listing.
readRepliesAfterFailedDataConn:
readCommandResponse:
idleTimeoutMs: 1000
tlsReadIncoming: Socket operation timeout.
Failed to receive more TLS applicaton data.
Failed to read FTP control channel reply.
readFtpReply: Socket operation timeout.
--readCommandResponse
--readRepliesAfterFailedDataConn
--fetchDirListing2
--fetchDirListing
N: -1
Failed.
--GetDirCount
--ChilkatLog
port binding is working, but the PORT command has to use my external ip
please help. did i missed something?
i already tried connecting without put_ForcePortIpAddress()
. after connect i used put_ForcePortIpAddress()
, but this wont work either.
Thanks in advance for any help
marco