Skip to content

client cannot connect to the server  #397

@Yuratos

Description

@Yuratos

Hi everyone,
I want to connect to the OPCUA python server example ("minimal server" in https://github.com/FreeOpcUa/python-opcua), with samples/simple-client from this repository as client, but when I trying to create connection answer from client request:

Frame 377: 171 bytes on wire (1368 bits), 171 bytes captured (1368 bits) on interface lo, id 0
    Interface id: 0 (lo)
        Interface name: lo
    Encapsulation type: Ethernet (1)
    Arrival Time: Oct 30, 2024 15:34:27.893535986 MSK
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1730291667.893535986 seconds
    [Time delta from previous captured frame: 0.000617176 seconds]
    [Time delta from previous displayed frame: 0.000617176 seconds]
    [Time since reference or first frame: 34.498363855 seconds]
    Frame Number: 377
    Frame Length: 171 bytes (1368 bits)
    Capture Length: 171 bytes (1368 bits)
    [Frame is marked: True]
    [Frame is ignored: False]
    [Protocols in frame: eth:ethertype:ip:tcp:opcua]
    [Coloring Rule Name: TCP]
    [Coloring Rule String: tcp]
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
    Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Source: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Type: IPv4 (0x0800)
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
        0000 00.. = Differentiated Services Codepoint: Default (0)
        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
    Total Length: 157
    Identification: 0xcea8 (52904)
    Flags: 0x40, Don't fragment
        0... .... = Reserved bit: Not set
        .1.. .... = Don't fragment: Set
        ..0. .... = More fragments: Not set
    ...0 0000 0000 0000 = Fragment Offset: 0
    Time to Live: 64
    Protocol: TCP (6)
    Header Checksum: 0x6db0 [validation disabled]
    [Header checksum status: Unverified]
    Source Address: 127.0.0.1
    Destination Address: 127.0.0.1
Transmission Control Protocol, Src Port: 57496, Dst Port: 4840, Seq: 1510, Ack: 786, Len: 105
    Source Port: 57496
    Destination Port: 4840
    [Stream index: 144]
    [Conversation completeness: Complete, WITH_DATA (31)]
    [TCP Segment Len: 105]
    Sequence Number: 1510    (relative sequence number)
    Sequence Number (raw): 2156901541
    [Next Sequence Number: 1615    (relative sequence number)]
    Acknowledgment Number: 786    (relative ack number)
    Acknowledgment number (raw): 1417837949
    1000 .... = Header Length: 32 bytes (8)
    Flags: 0x018 (PSH, ACK)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set
        .... .0.. .... = ECN-Echo: Not set
        .... ..0. .... = Urgent: Not set
        .... ...1 .... = Acknowledgment: Set
        .... .... 1... = Push: Set
        .... .... .0.. = Reset: Not set
        .... .... ..0. = Syn: Not set
        .... .... ...0 = Fin: Not set
        [TCP Flags: ·······AP···]
    Window: 508
    [Calculated window size: 65024]
    [Window size scaling factor: 128]
    Checksum: 0xfe91 [unverified]
    [Checksum Status: Unverified]
    Urgent Pointer: 0
    Options: (12 bytes), No-Operation (NOP), No-Operation (NOP), Timestamps
        TCP Option - No-Operation (NOP)
            Kind: No-Operation (1)
        TCP Option - No-Operation (NOP)
            Kind: No-Operation (1)
        TCP Option - Timestamps: TSval 2644561063, TSecr 2644561062
            Kind: Time Stamp Option (8)
            Length: 10
            Timestamp value: 2644561063
            Timestamp echo reply: 2644561062
    [Timestamps]
        [Time since first frame in this TCP stream: 0.007449835 seconds]
        [Time since previous frame in this TCP stream: 0.000617176 seconds]
    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 376]
        [The RTT to ACK the segment was: 0.000617176 seconds]
        [iRTT: 0.000050712 seconds]
        [Bytes in flight: 105]
        [Bytes sent since last PSH flag: 105]
    TCP payload (105 bytes)
    [PDU Size: 105]
OpcUa Binary Protocol
    Message Type: MSG
    Chunk Type: F
    Message Size: 105
    SecureChannelId: 10
    Security Token Id: 13
    Security Sequence Number: 4
    Security RequestId: 1004
    OpcUa Service : Encodeable Object
        TypeId : ExpandedNodeId
            NodeId EncodingMask: Four byte encoded Numeric (0x01)
            NodeId Namespace Index: 0
            NodeId Identifier Numeric: ActivateSessionRequest (467)
        ActivateSessionRequest
            RequestHeader: RequestHeader
                AuthenticationToken: NodeId
                    .... 0001 = EncodingMask: Four byte encoded Numeric (0x1)
                    Namespace Index: 0
                    Identifier Numeric: 1004
                Timestamp: Oct 30, 2024 15:34:27.893359900 MSK
                RequestHandle: 18
                Return Diagnostics: 0x00000000
                    .... .... .... ...0 = ServiceLevel / SymbolicId: False
                    .... .... .... ..0. = ServiceLevel / LocalizedText: False
                    .... .... .... .0.. = ServiceLevel / AdditionalInfo: False
                    .... .... .... 0... = ServiceLevel / Inner StatusCode: False
                    .... .... ...0 .... = ServiceLevel / Inner Diagnostics: False
                    .... .... ..0. .... = OperationLevel / SymbolicId: False
                    .... .... .0.. .... = OperationLevel / LocalizedText: False
                    .... .... 0... .... = OperationLevel / AdditionalInfo: False
                    .... ...0 .... .... = OperationLevel / Inner StatusCode: False
                    .... ..0. .... .... = OperationLevel / Inner Diagnostics: False
                AuditEntryId: [OpcUa Null String]
                TimeoutHint: 60000
                AdditionalHeader: ExtensionObject
                    TypeId: ExpandedNodeId
                        EncodingMask: 0x00, EncodingMask: Two byte encoded Numeric
                            .... 0000 = EncodingMask: Two byte encoded Numeric (0x0)
                            .0.. .... = has server index: False
                            0... .... = has namespace uri: False
                        Identifier Numeric: 0
                    EncodingMask: 0x00
                        .... ...0 = has binary body: False
                        .... ..0. = has xml body: False
            ClientSignature: SignatureData
                Algorithm: [OpcUa Null String]
                Signature: <MISSING>[OpcUa Null ByteString]
            ClientSoftwareCertificates: Array of SignedSoftwareCertificate
                ArraySize: -1
            LocaleIds: Array of String
                ArraySize: -1
            UserIdentityToken: ExtensionObject
                TypeId: ExpandedNodeId
                    EncodingMask: 0x01, EncodingMask: Four byte encoded Numeric
                        .... 0001 = EncodingMask: Four byte encoded Numeric (0x1)
                        .0.. .... = has server index: False
                        0... .... = has namespace uri: False
                    Namespace Index: 0
                    Identifier Numeric: 321
                EncodingMask: 0x01, has binary body
                    .... ...1 = has binary body: True
                    .... ..0. = has xml body: False
                AnonymousIdentityToken: AnonymousIdentityToken
                    PolicyId: anonymous
            UserTokenSignature: SignatureData
                Algorithm: [OpcUa Null String]
                Signature: <MISSING>[OpcUa Null ByteString]

server answer:

Frame 378: 118 bytes on wire (944 bits), 118 bytes captured (944 bits) on interface lo, id 0
    Interface id: 0 (lo)
        Interface name: lo
    Encapsulation type: Ethernet (1)
    Arrival Time: Oct 30, 2024 15:34:27.894626940 MSK
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1730291667.894626940 seconds
    [Time delta from previous captured frame: 0.001090954 seconds]
    [Time delta from previous displayed frame: 0.001090954 seconds]
    [Time since reference or first frame: 34.499454809 seconds]
    Frame Number: 378
    Frame Length: 118 bytes (944 bits)
    Capture Length: 118 bytes (944 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: eth:ethertype:ip:tcp:opcua]
    [Coloring Rule Name: TCP]
    [Coloring Rule String: tcp]
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
    Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Source: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Type: IPv4 (0x0800)
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
        0000 00.. = Differentiated Services Codepoint: Default (0)
        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
    Total Length: 104
    Identification: 0x065a (1626)
    Flags: 0x40, Don't fragment
        0... .... = Reserved bit: Not set
        .1.. .... = Don't fragment: Set
        ..0. .... = More fragments: Not set
    ...0 0000 0000 0000 = Fragment Offset: 0
    Time to Live: 64
    Protocol: TCP (6)
    Header Checksum: 0x3634 [validation disabled]
    [Header checksum status: Unverified]
    Source Address: 127.0.0.1
    Destination Address: 127.0.0.1
Transmission Control Protocol, Src Port: 4840, Dst Port: 57496, Seq: 786, Ack: 1615, Len: 52
    Source Port: 4840
    Destination Port: 57496
    [Stream index: 144]
    [Conversation completeness: Complete, WITH_DATA (31)]
    [TCP Segment Len: 52]
    Sequence Number: 786    (relative sequence number)
    Sequence Number (raw): 1417837949
    [Next Sequence Number: 838    (relative sequence number)]
    Acknowledgment Number: 1615    (relative ack number)
    Acknowledgment number (raw): 2156901646
    1000 .... = Header Length: 32 bytes (8)
    Flags: 0x018 (PSH, ACK)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set
        .... .0.. .... = ECN-Echo: Not set
        .... ..0. .... = Urgent: Not set
        .... ...1 .... = Acknowledgment: Set
        .... .... 1... = Push: Set
        .... .... .0.. = Reset: Not set
        .... .... ..0. = Syn: Not set
        .... .... ...0 = Fin: Not set
        [TCP Flags: ·······AP···]
    Window: 512
    [Calculated window size: 65536]
    [Window size scaling factor: 128]
    Checksum: 0xfe5c [unverified]
    [Checksum Status: Unverified]
    Urgent Pointer: 0
    Options: (12 bytes), No-Operation (NOP), No-Operation (NOP), Timestamps
        TCP Option - No-Operation (NOP)
            Kind: No-Operation (1)
        TCP Option - No-Operation (NOP)
            Kind: No-Operation (1)
        TCP Option - Timestamps: TSval 2644561064, TSecr 2644561063
            Kind: Time Stamp Option (8)
            Length: 10
            Timestamp value: 2644561064
            Timestamp echo reply: 2644561063
    [Timestamps]
        [Time since first frame in this TCP stream: 0.008540789 seconds]
        [Time since previous frame in this TCP stream: 0.001090954 seconds]
    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 377]
        [The RTT to ACK the segment was: 0.001090954 seconds]
        [iRTT: 0.000050712 seconds]
        [Bytes in flight: 52]
        [Bytes sent since last PSH flag: 52]
    TCP payload (52 bytes)
    [PDU Size: 52]
OpcUa Binary Protocol
    Message Type: MSG
    Chunk Type: F
    Message Size: 52
    SecureChannelId: 10
    Security Token Id: 13
    Security Sequence Number: 4
    Security RequestId: 1004
    OpcUa Service : Encodeable Object
        TypeId : ExpandedNodeId
            NodeId EncodingMask: Four byte encoded Numeric (0x01)
            NodeId Namespace Index: 0
            NodeId Identifier Numeric: ServiceFault (397)
        ServiceFault
            ResponseHeader: ResponseHeader
                Timestamp: Oct 30, 2024 15:34:27.894293000 MSK
                RequestHandle: 18
                ServiceResult: 0x80250000 [BadSessionIdInvalid]
                ServiceDiagnostics: DiagnosticInfo
                    EncodingMask: 0x00
                        .... ...0 = has symbolic id: False
                        .... ..0. = has namespace: False
                        .... .0.. = has localizedtext: False
                        .... 0... = has locale: False
                        ...0 .... = has additional info: False
                        ..0. .... = has inner statuscode: False
                        .0.. .... = has inner diagnostic info: False
                StringTable: Array of String
                    ArraySize: 0
                AdditionalHeader: ExtensionObject
                    TypeId: ExpandedNodeId
                        EncodingMask: 0x00, EncodingMask: Two byte encoded Numeric
                            .... 0000 = EncodingMask: Two byte encoded Numeric (0x0)
                            .0.. .... = has server index: False
                            0... .... = has namespace uri: False
                        Identifier Numeric: 0
                    EncodingMask: 0x00
                        .... ...0 = has binary body: False
                        .... ..0. = has xml body: False

ip adress for client and server use localhost, offcourse client must create subscription to "My_Object" node.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions