Nov-19-2019, 03:45 PM
Dear All Friends.
I am trying to communicate with an IEC-60870-5-104 server through TCP sockets. The IEC server is located over the local host 127.0.0.1: 2404 and I am trying to send a HEX message with the help of send() function. Please look at my code
0x68 0x04 0x07 0x00 0x00 0x00
In response it receives the hex message 0x68 0x04 0x0B 0x00 0x00 0x00
I confirmed this with Wireshark but what I find on my shell is
======== RESTART: C:/Users/Shahrukh/Desktop/Python Coding/TCP Server.py ========
Socket successfully created
received data: b'h\x04\x0b\x00\x00\x00'
>>>
Only 5 bytes are shown, where is the 1st byte 0x68? I must receive and show 0x68 0x04 0x0B 0x00 0x00 0x00, whats wrong? Please help
I am trying to communicate with an IEC-60870-5-104 server through TCP sockets. The IEC server is located over the local host 127.0.0.1: 2404 and I am trying to send a HEX message with the help of send() function. Please look at my code
#import the socket library import socket # create a socket object s = socket.socket() print("Socket successfully created") # connect to the server on local computer, 2404 default port for IEC-104 Server s.connect(('127.0.0.1', 2404)) # send a hex message in bytes s.send(b'\x68\x04\x07\x00\x00\x00') data = s.recv(1024) s.close() print( "received data:", data)Now when i run the code, it connects successfully with the server, Sends the HEX message which is
0x68 0x04 0x07 0x00 0x00 0x00
In response it receives the hex message 0x68 0x04 0x0B 0x00 0x00 0x00
I confirmed this with Wireshark but what I find on my shell is
======== RESTART: C:/Users/Shahrukh/Desktop/Python Coding/TCP Server.py ========
Socket successfully created
received data: b'h\x04\x0b\x00\x00\x00'
>>>
Only 5 bytes are shown, where is the 1st byte 0x68? I must receive and show 0x68 0x04 0x0B 0x00 0x00 0x00, whats wrong? Please help