Skip to content
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

monitor port output should produce some kind of end-of-message marker #21

Open
nettings opened this issue Aug 10, 2017 · 2 comments
Open

Comments

@nettings
Copy link

To experiment with the monitoring feature, I'm running a netcat listener like so:

pi@pieight:~ $ nc -l 6666

This results in the following output for multiple monitored events:
monitor 1 gain -10.000000monitor 1 gain -3.000000...
Which is somewhat tedious to parse. Is this intentional? If not, can I suggest to add a newline to mark the end of a message, like so:

pi@pieight:~/build/mod-host $ git diff
diff --git a/src/monitor.c b/src/monitor.c
index 1057598..64676ea 100644
--- a/src/monitor.c
+++ b/src/monitor.c
@@ -164,7 +164,7 @@ int monitor_send(int instance, const char *symbol, float value)
     int ret;
 
     char msg[255];
-    sprintf(msg, "monitor %d %s %f", instance, symbol, value);
+    sprintf(msg, "monitor %d %s %f\n", instance, symbol, value);
 
     ret = write(g_sockfd, msg, strlen(msg) + 1);
     if (ret < 0)

@falkTX
Copy link
Member

falkTX commented Aug 10, 2017

When reading the socket manually there's a '\0' character terminator after each event.
Perhaps there's a way to convert those in nc tool into a newline?

@falkTX
Copy link
Member

falkTX commented Aug 10, 2017

btw, that monitor code is not RT safe. it writes to the socket in the process function.
something to take into consideration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants