Comments (9)
IMO the current behavior of client.close()
is fine (see the link @yaacov referred as [3]).
If there is need for socket.destroy()
I would place it in a separate method as @yaacov proposed. Users of this library should not be forced to use internal stuff (client._client
should never be used outside the library).
from node-modbus-serial.
Hi, currently the client.close()
[1] method, only calls socket.end()
[2]
I do not want to change that behaviour, but we can add a destroy
call if necessary, @connium WDYT ?
@sujeethk a workaround that may solve your problem:
calling .destroy()
[3] directly on the tcp socket:
client._client.destroy();
[1] https://github.com/yaacov/node-modbus-serial/blob/master/ports/tcpport.js#L97
[2] https://nodejs.org/api/net.html#net_socket_end_data_encoding
[3] https://nodejs.org/api/net.html#net_socket_destroy_exception
from node-modbus-serial.
Hi all, If the workaround described in #96 (comment) works, I will add a .destory
function to the client as @connium suggested.
But we need to know that this was the problem, and that calling client._client.destroy();
fixes it. @sujeethk can you try it, and comment here if this solve/not solve the problem ?
from node-modbus-serial.
@sujeethk ping ^^
from node-modbus-serial.
Apologies for not getting back earlier. When I log client._client
it does not have a destroy method.
And I assume there is a wait timeout for the socket to close before being destroyed which is why the socket doesn't close immediately after calling close.
from node-modbus-serial.
a. np :-)
b. client._client
should be a socket ( it has a destroy
method )
- can you write here the relevant code you are using ?
- where/when socket is still connected,
- where/when you see that
client._client
is not a socket anymore ( does not have adestroy
method )
from node-modbus-serial.
@sujeethk I didn't understand, is this working now ? do we need to close this issue ( it is solve already ) , or we need to fix it , how ?
from node-modbus-serial.
I think we can close this issue since it is working as designed. When we call close on the socket, it flags it for closing but waits until the default timeout to make sure there are no pending transmission from the other client. Once the timeout is done it closes the socket.
from node-modbus-serial.
Thanks 👍
closing
from node-modbus-serial.
Related Issues (20)
- Port Not Open HOT 2
- Error after updating to 8.0.15 HOT 3
- Usage of isDebugEnabled to check the PDU raw data HOT 3
- Modbus TCP Connection was closed after 100 Seconds of Inactivity HOT 1
- ServerTCP causes uncaught exception if listen fails
- Permission denied, cannot open /dev/ttyUSB0
- Open-close function HOT 11
- Combination of modbus requests in the same TCP Frame. HOT 13
- Destroy function callback never to be called HOT 4
- Modbus RTU - CRC delay HOT 5
- Strange interaction with PLC when writing strings HOT 2
- multiple modbusRTU open/close will end with "Error Resource temporarily unavailable Cannot lock port" HOT 5
- ServerTCP: readHoldingRegisters throws Modbus exception 4: Slave device failure HOT 5
- Error "Buffer is not defined" during start Angular application HOT 7
- Does We have any plan using Typescript to refactor this repo?
- I expect to be able to return a string in the getMultipleInputRegisters method. HOT 6
- closing modbus connection using close() and it will crashing my electron app HOT 1
- ServerTCP getMultipleHoldingRegisters and getMultipleInputRegisters don't work with Promises
- 请问对于float,short,word等不同类型数据该如何读取 HOT 1
- Modbus TCP connect Telnet CRC Error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-modbus-serial.