Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 276100f

Browse files
committed
Prevent zmq errors on Octave
1 parent 86b61cd commit 276100f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

messenger/src/messenger.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ void mexFunction(int nlhs, mxArray *plhs[],
111111
int byte_recvd = listen_zmq(recv_buffer, BUFLEN);
112112

113113
while (byte_recvd == -1 && errno == EAGAIN) {
114-
byte_recvd = listen_zmq(recv_buffer, BUFLEN);
115114
mexCallMATLAB(0, NULL, 0, NULL, "drawnow");
115+
byte_recvd = listen_zmq(recv_buffer, BUFLEN);
116116
}
117117

118118
/* Check if the received data is complete and correct */
@@ -121,7 +121,8 @@ void mexFunction(int nlhs, mxArray *plhs[],
121121
} else if (byte_recvd > BUFLEN){
122122
mexErrMsgTxt("Receiver buffer overflow. Message truncated");
123123
} else {
124-
mexErrMsgTxt("Failed to receive a message due to ZMQ error");
124+
sprintf(recv_buffer, "Failed to receive a message due to ZMQ error %s", strerror(errno));
125+
mexErrMsgTxt(recv_buffer);
125126
}
126127

127128
return;

0 commit comments

Comments
 (0)