rosserial embedded tcp custom port fail

asked 2018-12-14 04:21:49 -0500

krl101 gravatar image

Hi there!

i just played around with rosserial and an tcp connection to my tiny linux board. Going through the tutorial is quiet easy. But if i try to run my node on a custom port it gives me:

Connecting to TCP server at}L�����ǐHu+�T���h俋�AH}L������H>T:11420....

code snippet:

char *rosSrvrIp = "";

Diggin into ros_lib/embedded_linux_comms.c i found this else-Path for a custom port: (somewhere around line 128)

    tcpPortNum = strtol(tcpPortNumString + 1, NULL, 10);
    strncpy(ip, portName, tcpPortNumString - portName);

printf("Connecting to TCP server at %s:%ld....\n", ip, tcpPortNum);

I have added following line after the strncpy-line:

ip[tcpPortNumString - portName] = '\0';   // set  null-terminator

An now it works for me

Question: Have i missed something obvious or does it belong to my compiler (gcc 5.3) ?

edit retag flag offensive close merge delete


I would recommend to report this over at ros-drivers/rosserial/issues instead of opening a Q&A here: it's an issue, not a question we can answer.

Following up: seeing as you have a candidate solution, I would recommend submitted a PR as well.

gvdhoorn gravatar imagegvdhoorn ( 2018-12-14 08:37:17 -0500 )edit