The talker at A host multicasts a message named 'EXAMPLE' to the network. The listeners at A and B host both receive the message and enter the handle function.
The talker at B host multicasts a message named 'EXAMPLE' to the network. The listener at B host can receive the message and enter the handle function. But the listener at A host never enter the handle function. Then i use Wireshark to monitor the network data at A host, the message from B host can be obtained by A host.
Test2:
A host IP : 192.168.151.167
B host IP: 192.168.151.79
The talker at A host multicasts a message named 'EXAMPLE' to the network. The listeners at A and B host both receive the message and enter the handle function.
The talker at B host multicasts a message named 'EXAMPLE' to the network. The listeners at A and B host both receive the message and enter the handle function.
The situation at Test1_2 does not happen!
Is there a problem with my A host configuration? Or multiple hosts's IP need to be set the same subnet when communicating each other?
System info:
Test1:
Test2:
Is there a problem with my A host configuration? Or multiple hosts's IP need to be set the same subnet when communicating each other?
Thank you and looking forward to your reply.
Codes:
using namespace std;
class Handler { public: ~Handler() {} void handleMessage(const lcm::ReceiveBuffer rbuf, const std::string &chan, const lcm_std_msgs::Header msg) { int i; printf("Received message on channel \"%s\":\n", chan.c_str()); printf(" timestamp = %lld\n", (long long)msg->seq); printf(" position = (%f, %f, %f)\n", msg->stamp); cout << msg->frame_id << endl; } };
int main(int argc, char *argv[]) { string address = "udpm://239.1.1.255:7667?ttl=1"; int i; lcm::LCM lcm(address) ; if (!lcm.good()) return 1; Handler handlerObject; lcm.subscribe("EXAMPLE", &Handler::handleMessage, &handlerObject);
}