-
Notifications
You must be signed in to change notification settings - Fork 73
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
Request: Return errno from native send() #130
Comments
We would have to introduce a new set of function otherwise we would break compatibility with existing code. Did you tried reading ERRNO directly from the script? The send-call itself is synchronous and this should be the only syscall in the call chain (except if nodejs is doing some hidden syscall). |
Yea I understand backwards compatibility is a concern. I'm not super familiar with natively compiled C libraries for node so I thought you might have a more elegant solution. |
We can add an additional function to read the errno. Would that work? |
Yea I think that would work. So if we detect a failed send, we can read the |
The
RawChannel.send()
method returns -1 if the send cannot be completed. Could the method somehow return an object including theerrno
set by the socket.h -> send() method? Or better yet, return the string parsed bystrerror()
to translate the errno to the system specific error.I understand returning an object is less clear than number of bytes or -1. I'm hoping you might have an idea for how to cleanly provide this info.
I was debugging a CAN interface issue and found the send() returned -1. But I didn't realize I had a txqueuelen issue until I recompiled the socketcan C code to provide this errno context (
105 ENOBUFS No buffer space available
). It'd be nice if node-can could provide that error information.The text was updated successfully, but these errors were encountered: