Comments (5)
You mean the chance to catch the error of a failed shutdown of the TcpStream? Does this make sense at all? What would be the consequence in the client code?
I agree, that the unwrap
must be removed to make the drop not crash the code.
from modbus-rs.
What would be the consequence in the client code?
e.g. write a message into the log file and rust continue the application. Let's say there are 100 devices that needs to be controlled. Some of them just needs to connect once an hour. Then I'd be pissed if my whole application crashes just because one connection shutdown panics!
from modbus-rs.
Yes that's correct. BTW. I don't know if the TcpStream
disconnects automatically after a drop, so we can skip the drop impl at all.
But a close
function would be usefull.
from modbus-rs.
BTW. I don't know if the
TcpStream
disconnects automatically after a drop
Yes, the example in https://doc.rust-lang.org/std/net/struct.TcpStream.html tells us that the stream closes after it runs out of scope.
from modbus-rs.
...and here https://doc.rust-lang.org/src/std/net/tcp.rs.html#25 we have it too:
The socket will be closed when the value is dropped.
from modbus-rs.
Related Issues (18)
- Implement coil/discrete input read functions HOT 2
- Error info is not detailed enough HOT 1
- MODBUS_MAX_READ_COUNT and MODBUS_MAX_WRITE_COUNT are hardcoded HOT 5
- Don't ignore errors in `scoped` drop functions
- error due to modbus-test-server
- Serial ASCII and RTU? HOT 1
- How specify the Unit ID to connect with? HOT 2
- Remove dependency on "diagslave" in tests HOT 3
- Server implementation? HOT 11
- Use libmodbus unittest server code
- Proposal: add support for modbus-RTU (and serial ports) HOT 3
- Clarification of `read_holding_registers` result HOT 2
- Best approach to read out multiple registers simultaneously HOT 2
- Transport implementing Clone HOT 4
- Proposal: Functions for dealing with multi-register values HOT 4
- byteorder big, wordorder little HOT 1
- MODBUS/TCP Security support HOT 2
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 modbus-rs.