(Thank you Josh for your helpful information!)
“I see that occasionally information from clients (with the client’s permission) end up on the blog and thought that perhaps this one would qualify. If there is mention of the C++ Runtime, I didn’t find it.
At any rate, I was having trouble getting the ChilkatDotNet4.dll to load. After a conversation with Matt, I tried installing the Microsoft Visual C++ 2010 Redistributable Package - this resolved my issue:
x86 Microsoft Visual C++ 2010 Redistributable Package
x64 Microsoft Visual C++ 2010 Redistributable Package
I’ve included the error messages below to illustrate that the .dll appears to be being found when registered to the GAC (and certainly when placed directly in the web site’s bin), but cannot load its dependencies.
When loaded into GAC but not found (or when in bin):
Could not load file or assembly ‘ChilkatDotNet4.dll’ or one of its dependencies. The specified module could not be found.
When not loaded into GAC and not in bin:
Could not load file or assembly ‘ChilkatDotNet4, Version=9.0.8.0, Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd’ or one of its dependencies. The system cannot find the file specified.”
The following Chilkat FTP2 error was found by a Chilkat customer to be caused by firewall restrictions. I do not know the specifics of the firewall restrictions that caused the error, but the LastErrorText (with all customer information removed) is reproduced here to help identify this problem in the future. The important point is to see that the SSL/TLS handshake completes to the very end, at which point the FTP client sends the “FINISHED” SSL/TLS handshake message, and then the firewall closes the connection.
ChilkatLog:
Connect:
DllDate: Jun 10 2010
UnlockPrefix: ****
Username: ****
Component: Visual C++ 8.0
ImplicitSsl: 0
AuthTls: 1
AuthSsl: 0
Hostname: ****
Port: 21
IdleTimeoutMs: 60000
HeartbeatMs: 0
ConnectTimeoutMs: 60000
myIP: ****
myPort: ****
connect successful.
initialStatus: 220
initialResponse: ****
converting to secure connection...
handshakeMessageType: ServerHello
handshakeMessageLen: 0x46
processHandshakeMessage:
MessageType: ServerHello
Processing ServerHello...
ServerHello:
MajorVersion: 3
MinorVersion: 1
SessionIdLen: 32
CipherSuite: RSA_WITH_3DES_EDE_CBC_SHA
CipherSuite: 00,0a
CompressionMethod: 0
Queueing ServerHello message.
ServerHello is OK.
handshakeMessageType: Certificate
handshakeMessageLen: 0x9b1
processHandshakeMessage:
MessageType: Certificate
ProcessCertificates:
Certificate:
derSize: 1288
certSubjectCN:
certSerial: ****
certIssuerCN: ****
Certificate:
derSize: 1184
certSubjectCN: ****
certSerial: ****
certIssuerCN:
NumCertificates: 2
Queueing Certificates message...
handshakeMessageType: ServerHelloDone
handshakeMessageLen: 0x0
processHandshakeMessage:
MessageType: ServerHelloDone
Queueing HelloDone message.
HandshakeQueue:
MessageType: ServerHello
MessageType: Certificate
MessageType: ServerHelloDone
Dequeued ServerHello message.
Dequeued Certificate message.
DequeuedMessageType: ServerHelloDone
OK to ServerHelloDone!
No client certificate required by the server.
Encrypted pre-master secret with server certificate RSA public key is OK.
Sending ClientKeyExchange...
Sent ClientKeyExchange message.
Sending ChangeCipherSpec...
Sent ChangeCipherSpec message.
Derived keys.
Installed new outgoing security params.
Sending FINISHED message..
algorithm: des
keyLength: 192
Sent FINISHED message..
numBytesRequested: 5
Connection closed by server.
Failed to read beginning of SSL/TLS record.
Failed to read incoming handshake messages. (3)
Client handshake failed.
Failed to convert channel to SSL/TLS
Failed to connect to FTP server.
Question:
I have added HTML email file support (thanks to your excellent examples and library), but I have a question. It appears that it might be easier for the end user to save their things they want to email as a MHT file instead of HTML out of MS-Word. That way they have one file to deal with. So is there a way to do the same method for email using and MHT file?
Answer:
MHT and EML are the exact same thing — they are both MIME. The only difference is the file extension and the intended use of the file (as indicated by the file extension). MHT is intended to be displayed in Internet Explorer, and EML is intended to be an email. A .eml file will contain header files (Subject, To, From, etc.) that are not present in MHT. Therefore, to “convert” an MHT to EML, simply load it into an email object by calling LoadEml, set the Subject and From properties. Then Add recipients by calling AddTo, AddCC, etc., and then send…
The correct way to pass a string to a COM/ActiveX method is to use “WideString (theString).c_bstr()” because ActiveX controls/components require BSTR’s, and not strings. BSTR’s are wide strings (Unicode) where the length of the string precedes the string in memory.
The C++ Builder code to pass a string to an ActiveX function is as follows:
FClientSock = new TChilkatSocket(Owner);
success = FClientSock->UnlockComponent(WideString("30 day trial").c_bstr());
Question:
“I’ve got the Chilkat C++ libs linked with my project, and am using the HTTP classes successfully.
One thing is confusing me, though. I’ve derived a class from CkHttpProgress.h and overridden AbortCheck(…) to provide cancellation support. However, AbortCheck(…) never gets called. At first, I thought perhaps the HTTP retrieval was occurring too quickly, so I set the “HeartbeatMs” property to “1″, and it still never gets called.
I know the assignment of the callback class is working, because if I override PercentDone(…), it does indeed get called.
Is it possible that my use of the HTTP QuickGetStr(…) method does not support the AbortCheck(…) callback? I’m (successfully) reading a small XML file from a web server in close proximity to the client.”
Answer:
The PercentDone callback method also has an “abort” argument, so it may also be used to abort a method while in progress. In cases where the PercentDone callback provides abort capability, it counts as an AbortCheck callback — to prevent too many callbacks from bombarding your application.
Therefore, if HeartbeatMs is set to 100ms, and a PercentDone callback is fired, then the timer for the next AbortCheck callback is reset. The entire operation could be short enough such that all of the callbacks are PercentDone callbacks, and AbortCheck never gets called. The AbortCheck callback would only be called when the elapsed time between 1% completion intervals exceeds the HeartbeatMs.