-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modbux.Tcp.Client terminates when TCP response contains 2 payloads #14
Comments
Hi, Can you confirm (using wireshark or similar) that you are indeed receiving both payloads in the same tcp message? I think that the problem is the :packet option of :gen_tcp (currently :raw). |
Thanks for your quick reply. Currently the machine is located remote. But I will get it. |
I attached the packets log, the_packets.pcapng.zip, that I captured by wireshark. The issue's log is following, <<0x4, 0x7B>>, <<0x4,0x7C>> corresponds to trans id 1147, 1148. 07:44:03.214 [error] (Elixir.Modbux.Tcp) size = 6, payload_size = 17, msg = <<0x4, 0x7B, 0x0, 0x0, 0x0, 0x6, 0x0, 0x5, 0x0, 0x10, 0x0, 0x0, 0x4, 0x7C, 0x0, 0x0, 0x0, 0x5, 0x0, 0x2, 0x2, 0x0, 0x0>>
07:44:03.215 [error] GenServer #PID<0.1849.0> terminating
** (FunctionClauseError) no function clause matching in Modbux.Response.parse/2
(modbux 0.3.13) lib/helpers/response.ex:64: Modbux.Response.parse({:fc, 0, 16, 0}, nil)
(modbux 0.3.13) lib/tcp/client.ex:330: Modbux.Tcp.Client.handle_info/2
(stdlib 6.0) gen_server.erl:2173: :gen_server.try_handle_info/3
(stdlib 6.0) gen_server.erl:2261: :gen_server.handle_msg/6
(stdlib 6.0) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Last message: {:tcp, #Port<0.69>, <<4, 123, 0, 0, 0, 6, 0, 5, 0, 16, 0, 0, 4, 124, 0, 0, 0, 5, 0, 2, 2, 0, 0>>} The following capture show the issue packets, This response was from Line 315 in fead05e
then Line 330 in fead05e
finally reached here Line 34 in fead05e
So I guess that |
Hi, I create this branch, that expose the Example:
|
Hi, I read the stackoverflow link and the section of the book, Programming Erlang). In my understanding, I cannot use the option for this case. Because the target machine, modbus server, doesn't support the header length which Thanks. |
@alde103 This is not an immediate issue, so it's enough if you took this as a report that I have found such a case. |
Hi, thanks for your modbus library. I found an issue when I use this library. So I report.
What happens
Modbux.Tcp.Client terminates when TCP response contains 2 payloads.
Following is the log,
There are two payloads in the response.
<<0x7, 0x8E, 0x0, 0x0, 0x0, 0x5, 0x0, 0x2, 0x2, 0x1, 0x80>>
<<0x7, 0x8F, 0x0, 0x0, 0x0, 0x6, 0x0, 0x5, 0x0, 0x10, 0xFF, 0x0>>
But following code try to handle this response as one payload, so it fails.
modbux/lib/tcp/client.ex
Line 315 in fead05e
If you need any info, let me know. Thank you!
The text was updated successfully, but these errors were encountered: