login about faq

Hello,

I am trying to connect to a host using Chillkat Socket v9.4.1 (ActiveX Version)

We are using SSL certificates and loading them successfully, but when we action the Connect method, it completes successfully (Connect method returns 1), but the Socket is not connected I can see no Errors anywhere in the Logs, (LastMethodFailed = 0, ConnectFailReason=0)

We have confirmed That there is no firewall issues, between us (client) and the host we are attempting to connect to.

I have seen That the logs state that a "Secure Channel was Established" - which would suggest that it has connected, but I cannot see any other evidence of this.

Can anyone tell me what may cause this bvehaviour? Any help would be greatly appreciated. Example code and results to follow below.

Thank you Andrew.

  Set cert = New ChilkatCert

  plngSuccess = chlSocket.UnlockComponent("UnlockCode")

  chlSocket.Close 10000 'max time allowed is 10 seconds (function uses microseconds)

  'if we have reached this point then we have a clean socket control in a not connected state
  pstrRemoteIPAddress = "12.24.56.78"
  pstrRemotePort = "12345"
  plngSSL = 1

  plngSuccess = cert.LoadByCommonName("MyCertificateName")
  chlSocket.SetSslClientCert cert

  chlSocket.ClearSessionLog
  chlSocket.SessionLogEncoding = "hex"
  chlSocket.KeepSessionLog = 1
  chlSocket.VerboseLogging = 1
  chlSocket.DebugLogFilePath = "D:\temp\chillkat\error.log"

  chlSocket.ssl = plngSSL
  chlSocket.SslProtocol = "default" '- the socket will determine the protocol once connected to server
  chlSocket.SocksVersion = 4 'SOCKS4
  chlSocket.SocksHostname = "myProxy.com"
  chlSocket.SocksPort = "1080"

  st = GetTickCount()

  plngSuccess = chlSocket.Connect(pstrRemoteIPAddress, pstrRemotePort, plngSSL, 20000)
  Debug.Print "IsConnected [" & chlSocket.IsConnected & "]"
  Debug.Print "Success [" & plngSuccess & "] in [" & GetTickCount - st & "] millisecs"

  If chlSocket.LastMethodFailed = 1 Then
     i = 1
     pstrMessage = ""

     If chlSocket.IsConnected = 1 Then
        Debug.Print "Connected but with errors"
     Else
        Debug.Print "Failed to connect"
     End If
     Debug.Print chlSocket.LastErrorText

     GoTo FinishedSendTCPIPData

  ElseIf chlSocket.IsConnected = 0 Then

     Debug.Print "Not Connected"
     Debug.Print chlSocket.LastErrorText

  Else
     Debug.Print "Connected"
  End If

  chlSocket.Close (10000)
  chlSocket.Dispose

RESULTS:

Success [1] in [4063] millisecs
Not Connected
ChilkatLog:
  IsConnected:
    DllDate: Aug 15 2013
    ChilkatVersion: 9.4.1.42
    UnlockPrefix: CodePrefix
    Username: Username
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 1
    fd: 0xffffffff
    objectId: 2
  --IsConnected
--ChilkatLog

LOG FILE CONTENTS

Connect_Socket:
    DllDate: Aug 15 2013
    ChilkatVersion: 9.4.1.42
    UnlockPrefix: CodePrefix
    Username: UserName
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 1
    objectId: 2
    Connect_Socket:
        hostname: 12.34.56.78
        port: 12345
        ssl: 1
        maxWaitMs: 20000
        SOCKS4:
            socksHostname: MyProxy.com
            socksPort: 1080
            socksUsername: 
            (leaveContext)
        ConnectTimeoutMs_1: 20000
        calling ConnectSocket2
        IPV6 enabled connect with NO heartbeat.
        connectingTo: MyProxy.com
        resolveHostname1:
            Resolving domain name (IPV4) via gethostbyname
            (leaveContext)
        GetHostByNameHB_ipv4: Elapsed time: 16 millisec
        myIP_1: 10.80.103.111
        myPort_1: 1469
        connect successful (1)
        ConvertToTls_10:
            clientHandshake:
                cacheClientCerts:
                    (leaveContext)
                clientHelloMajorMinorVersion: 3.1
                buildClientHello:
                    majorVersion: 3
                    minorVersion: 1
                    numRandomBytes: 32
                    sessionIdSize: 0
                    numCipherSuites: 10
                    numCompressionMethods: 1
                    (leaveContext)
                readIncomingTls_serverHello:
                    readTlsRecord:
                        (leaveContext)
                    processTlsRecord:
                        processHandshake:
                            handshakeMessageType: ServerHello
                            handshakeMessageLen: 0x46
                            processHandshakeMessage:
                                MessageType: ServerHello
                                Processing ServerHello...
                                ServerHello:
                                    MajorVersion: 3
                                    MinorVersion: 0
                                    SessionIdLen: 32
                                    CipherSuite: RSA_WITH_3DES_EDE_CBC_SHA
                                    CipherSuite: 00,0a
                                    CompressionMethod: 0
                                    Queueing ServerHello message.
                                    ServerHello is OK.
                                    (leaveContext)
                                (leaveContext)
                            handshakeMessageType: Certificate
                            handshakeMessageLen: 0x40f
                            processHandshakeMessage:
                                MessageType: Certificate
                                ProcessCertificates:
                                    parseX509_DER:
                                        der_to_xml:
                                            (leaveContext)
                                        (leaveContext)
                                    Certificate:
                                        derSize: 1033
                                        certSubjectCN: certName
                                        certSerial: 07
                                        certIssuerCN: 12.34.56.78
                                        (leaveContext)
                                    NumCertificates: 1
                                    Queueing Certificates message...
                                    (leaveContext)
                                (leaveContext)
                            handshakeMessageType: CertificateRequest
                            handshakeMessageLen: 0x1a95
                            processHandshakeMessage:
                                MessageType: CertificateRequest
                                CertificateRequest:
                                    NumCertificateTypes: 2
                                    Certificate Type: RSA Sign
                                    Certificate Type: DSS Sign
                                    totalLen: 6800
                                    dn_toString:
                                        (leaveContext)
                                        .
                                        . 'REMOVED CERTIFICATE DETAILS 
                                        .
                                        (leaveContext)

                                    NumDistinguishedNames: 52
                                    CertificateRequest message is OK.
                                    Queueing CertificateRequest message.
                                    (leaveContext)
                                (leaveContext)
                            handshakeMessageType: ServerHelloDone
                            handshakeMessageLen: 0x0
                            processHandshakeMessage:
                                MessageType: ServerHelloDone
                                Queueing HelloDone message.
                                (leaveContext)
                            (leaveContext)
                        (leaveContext)
                    (leaveContext)
                HandshakeQueue:
                    MessageType: ServerHello
                    MessageType: Certificate
                    MessageType: CertificateRequest
                    MessageType: ServerHelloDone
                    (leaveContext)
                Dequeued ServerHello message.
                Dequeued Certificate message.
                Dequeued CertificateRequest message.
                DequeuedMessageType: ServerHelloDone
                OK to ServerHelloDone!
                Sending 0-length certificate (this is normal).
                CertificatesMessage:
                    numCerts: 0
                    CertificateSize: 0x3
                    (leaveContext)
                der_to_xml:
                    (leaveContext)
                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..
                readIncomingTls_changeCipherSpec2:
                    readTlsRecord:
                        (leaveContext)
                    processTlsRecord:
                        processChangeCipherSpec:
                            ccsProtocolType: 1
                            (leaveContext)
                        (leaveContext)
                    (leaveContext)
                readIncomingTls_handshakeFinished2:
                    readTlsRecord:
                        (leaveContext)
                    processTlsRecord:
                        processHandshake:
                            handshakeMessageType: HandshakeFinished
                            handshakeMessageLen: 0x24
                            processHandshakeMessage:
                                MessageType: HandshakeFinished
                                FinishedMsgLen: 36
                                Queueing Finished message.
                                (leaveContext)
                            (leaveContext)
                        (leaveContext)
                    (leaveContext)
                Dequeue the FINISHED message...
                Dequeued Finished message.
                Handshake completed successfully.
                (leaveContext)
            checkServerCertRequirement:
                (leaveContext)
            Secure Channel Established.
            (leaveContext)
        socketOptions:
            SO_SNDBUF: 8192
            SO_RCVBUF: 8192
            TCP_NODELAY: 0
            (leaveContext)
        Success.
        (leaveContext)
    (leaveContext)
IsConnected:
    DllDate: Aug 15 2013
    ChilkatVersion: 9.4.1.42
    UnlockPrefix: codePrefix
    Username: UserName
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 1
    fd: 0x458
    objectId: 2
    (leaveContext)
IsConnected:
    DllDate: Aug 15 2013
    ChilkatVersion: 9.4.1.42
    UnlockPrefix: codePrefix
    Username: UserName
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 1
    fd: 0xffffffff
    objectId: 2
    (leaveContext)
Close:
    DllDate: Aug 15 2013
    ChilkatVersion: 9.4.1.42
    UnlockPrefix: codePrefix
    Username: UserName
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 1
    fd: 0xffffffff
    objectId: 2
    (leaveContext)

asked Mar 17 '14 at 08:19

AndrewHumphries's gravatar image

AndrewHumphries
1112


Turned out to be invalid Certificate Authentication. Although, It would have been nice to have some evidence of this on the Socket!

link

answered Mar 20 '14 at 10:16

AndrewHumphries's gravatar image

AndrewHumphries
1112

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×96
×15
×1

Asked: Mar 17 '14 at 08:19

Seen: 1,116 times

Last updated: Mar 20 '14 at 10:16

powered by OSQA