Comments (13)
@BenMenking Just want to say thanks for this lib it saves my life
from routeros-api.
Looking at those lines, I'm suspecting that the socket is no longer valid (possibly false). Ideally we would check for socket validity before the fwrite() and then handle any errors appropriately at that point.
Another possibility is that connect() was not called before write() is being called. Regardless, write() should check for a valid socket and protest much if invalid.
from routeros-api.
I just realized that I was connecting to the wrong IP. In this case we were never able to connect at all... so we should add some tests that look for:
if (!$this->connected) {
return false;
}
Before each call to read/write?
from routeros-api.
Well, as I've been thinking about this, I'm wondering if we should also change connect() to only attempt once instead of multiple times. Let the caller of connect() handle errors, which more than likely can't be fixed by multiple attempts.
Adding a socket validity check should be done. Represent errors in the form of exceptions?
from routeros-api.
Additionally, connect() should have returned false which the calling needs to trap and handle. Maybe use an exception so it's pretty clear there was a fatal error.
from routeros-api.
I agree with everything you said. It's my fault for not handling connect()
properly... but the library should also not toss a bunch of warnings if things go haywire.
from routeros-api.
Fully agree. I'll see what I can do here in the next hour or so.
from routeros-api.
For what it's worth... we've got over 1000 hEX's deployed now and we use this library to talk to all of them. It works great!
from routeros-api.
Great to hear! Maybe we can make some good incremental improvements during 2017 too :)
from routeros-api.
Now that we're relying on it more I'm sure I'll have some pull requests for you this year.
from routeros-api.
I've made those changes in branch better-error-handling so you can test them out. Didn't go as far as adding in exceptions right now.
from routeros-api.
I don't think you pushed that branch. I'm not seeing that on my local repo, or on Github.
from routeros-api.
It's there now. Had to find my laptop :)
from routeros-api.
Related Issues (20)
- Access MK in Digital Ocean HOT 8
- New API version HOT 2
- Access RB via Mac Address HOT 3
- PEAR2 UPDATE PLIS
- bonding/pppoe-client interface print HOT 1
- Login failed using this routeros API. HOT 3
- how to print torch data HOT 2
- SSL connection HOT 1
- how to run /system/script ? HOT 1
- disabled/enable NAT HOT 2
- torch not working HOT 8
- How to listen from stream. HOT 1
- Connecting to Mikrotik is not work HOT 5
- Socked timedout issue HOT 1
- Problem with PHP 8 HOT 1
- Commands not executed? HOT 4
- help HOT 2
- Can't get name simple que HOT 3
- How can I install Routeros API in my project Laravel
- three bugs and their fixes in comm() function 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 routeros-api.