Rosstalk and SendMessage with callback issue

Hi,

I’m trying to put in place a tcp communication using rosstalk and my device.

I’m using the sendmessage method with callback. The callback function is the one supposed to give me the response of my device a a tcp message.

The problem is that the response is always a null string.

I was wondering if there is a bug in Dashboard or if i’m doing something wrong.

The code looks like this:

function callback(success, sentData, resultString, exception)

{

ogscript.debug("TCP result: " + resultString);

}

var ip = params.getValue(0xC,0);

var port = params.getValue(0xD,0);

rosstalk.sendMessage(ip, port, message, callback);//Send message to external device
I would appreciate if somebody could shed some light on this issue.

Thanks

Bruno

Hi Bruno.

Unfortunately, the rosstalk.sendMessage will typically terminate the message after it has been sent without waiting for a response. The only exception to this is if the message sent ends with a “?” character. This is because rosstalk.sendMessage was designed for “fire and forget” messaging.

If you need to engage in a multi-message conversation over TCP/IP, one option you have is to use a tag (which can act as a server or connect as a client).

Hope this helps.

James

#DashBoard

Thanks James for the quick answer.

Bruno

#DashBoard

You’re welcome - please note that the post should have said " tag" (the forum originally hid the tag because I hadn’t escaped the brackets).

If you have any issues using the listener, please post back and we’ll do what we can to get you sorted.

James

#DashBoard