Closed sazima closed 2 years ago
Hi, If single-data, you can also write: body = ('U2', 1010)
However, I don't think this change will resolve this exception.
General format of 'S1F3' is
S1F3 W <L <U2 1010> ... >.
I recommend you to try
body = ('L', [ ('U2', 1010) ]) response = active.send(1, 3, True, body)
Thanks regards.
Maybe I used the wrong client version, or the configuration was wrong.
When I use the simulator to read data ('U2', 1012)
, The TCP body obtained by Wireshark is
b"\x00\x00\x01\x03\x00\x00\x00\x00\x00\x32\xa9\x02\x03\xf4"
, but the in pysemisecs is b'\x00\x00\x00\x0e\x00\x00\x81\x03\x00\x00\x00\x00\x00\x04\xa9\x02\x03\xf4'
, They are different in length.
ip_address='127.0.0.1'
active = secs.HsmsSsActiveCommunicator(
ip_address=ip_address,
port=5000,
session_id=0,
is_equip=False,
timeout_t3=45.0,
timeout_t5=10.0,
timeout_t6=55.0,
timeout_t8=55.0,
name='')
active.open()
r = active.open_and_wait_until_communicating()
body = ('U2', 1012)
response = active.send(1, 3, True, body) # b'\x00\x00\x00\x0e\x00\x00\x81\x03\x00\x00\x00\x00\x00\x04\xa9\x02\x03\xf4'
Hi,
Simulator data is wrong, No Length-4-bytes.
Checkpoint-1, Is there T8-timeout ?
'timeout_t8' is too big. T8 > T3 is NOT normal configuration. So raise T3-timeout before T8-timeout. If change configuration to T8 < T3 and raise T8-Timeout, Receive-TCP-data is wrong.
Checkpoint-2, Is ONLINE state ?
General-SECS-equipments do NOT accept requests before ONLINE-state. Do 'S1F17' before 'S1F3'.
body = ('U2', [1010]) response = active.send(1, 3, True, body)
I need to send is single-data body rather than an array. I tried this, but it seemed wrong.
Traceback (most recent call last): File xxxxxxxxxxxxx/secs/hsmssscommunicator.py", line xx, in send raise HsmsSsTimeoutT3Error("HsmsSs-Timeout-T3", msg) secs.hsmssscommunicator.HsmsSsTimeoutT3Error: HsmsSsTimeoutT3Error('HsmsSs-Timeout-T3',[00 00|81 03|00 00|00 00 00 04])
I found the reason. HsmsSsTimeoutT3Error is because I didn't reply to the s1f1 and s1f13 data from passive. Use add recv all msg Listen can solve
def recv_all_msg_listener(primary_msg, b):
# return
# pass
s, f = primary_msg.strm, primary_msg.func
LoggerFactory.get_logger().info(f's{s}f{f}')
if s == 1 and f == 1:
b.send(1, 2, False)
LoggerFactory.get_logger().info('send s1, f2 success')
if s== 1 and f == 13:
b.send_sml("""S1F14
<L [2]
<B [1] 0x00 >
<L [2]
<A [5] "DA100" >
<A [9] "V 2.0.0.4" >
>
>.""")
LoggerFactory.get_logger().info('send s1, f14 success')
active.add_recv_all_msg_listener(recv_all_msg_listener)
Hi,
To reply message, use .reply() or .reply_sml()
I need to send is single-data body rather than an array. I tried this, but it seemed wrong.