-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Adding listener to read data causes node to exit #1375
Comments
@kimushu can you take a look? There might be another event loop issue. |
oh,,, sorry. I made a mistake about reading in a latest commit. I'll send a pull request soon. |
For the time being, after googling, i used core node .js for that, it
worked, and i am wondering... (maybe its a new feature of node?, or its not
cross platform?)
````javascript
var fs = require('fs');
var buffer=""
fs.open("\\\\.\\COM2","r+" ,function (err, fd) {
if (err) {
return console.error(err);
}
var buffr = new Buffer(1);
fs.write(fd,"aaa")
function nextread(){
fs.write(fd,"@C"+buffer)
fs.read(fd, buffr, 0, buffr.length, 0, function (err, bytes) {
if (err) throw err;
// Print only read bytes to avoid junk.
if (bytes > 0) {
console.log(buffr.slice(0, bytes).toString());
buffer+=buffr.slice(0, bytes).toString()
console.log(buffer)
nextread()
}
});
}
nextread()
});
````
@C clears the display and echos the whole string (for my purpose)
In my raspberry pi i managed with "/dev/ACM0"
Are there any benefits of going C?
…On Mon, Oct 23, 2017 at 9:08 PM, kimushu ***@***.***> wrote:
oh,,, sorry. I made a big mistake about reading. I'll send a pull request
soon.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1375 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQJ0rdeyBeqUWyeZ4GBUuevwafScDCkrks5svTh2gaJpZM4QCEko>
.
--
Pinchas S. Neiman
845.213.1229 #2
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
SerialPort Version:6.0.3
NodeJS Version:v6.11.2
Operating System and Hardware Platform:win 10 x86_64
Have you checked the right version of the api docs?:?
Summary of Problem
i am able to write to the serial port
when i am doing a port.on("readable or on("data the script ends immediately, even if the event queaue is not empty
Steps and Code to Reproduce the Issue
The text was updated successfully, but these errors were encountered: