custom UDP messages [message #1818556] |
Thu, 19 December 2019 14:35 |
Niklas Huhs Messages: 32 Registered: October 2019 |
Member |
|
|
Hello everybody,
I am trying to create a block, which sends out a custom UDP message.
I already have a block using the "sendDataOnUDP" function and in debug messages in the console I can see that it is sending out the right amount of bits.
But still the message seems to get stuck somewhere as I cannot see anything while watching the network via wireshark.
The code for execute function looks like this:
void FORTE_WriteProp::executeEvent(int pa_nEIID){
paket_t WP;
char* acIPAddr = "xxx.xxx.xxx.xxx"; /
unsigned short Port;
Port = xxxxx;
CBSDSocketInterface::TUDPDestAddr DestAddr;
const char* IP = "xxx.xxx.xxx.xxx";
DestAddr.sin_family = AF_INET;
DestAddr.sin_port = htons(Port);
DestAddr.sin_addr.s_addr = inet_addr(IP);
CBSDSocketInterface::TSocketDescriptor Socket;
char* packet;
packet = (char*)℘
switch(pa_nEIID){
case scm_nEventINITID:
break;
case scm_nEventREQID:
int test;
Socket = CIPComSocketHandler::openUDPSendPort(acIPAddr, Port, &DestAddr);
test =CIPComSocketHandler::sendDataOnUDP(Socket, &DestAddr, packet, sizeof(WP));
break;
}
}
Compiling works without problems and I get return values from the functions. But probably there is something in the forte code which I didnt consider.
Does anybody have an idea?
best regards
[Updated on: Thu, 19 December 2019 16:24] Report message to a moderator
|
|
|
Re: custom UDP messages [message #1818569 is a reply to message #1818556] |
Thu, 19 December 2019 20:01 |
|
At a first look I don't see any obvious. However you should definitely not open in the REQ a socket. This is a time consuming process. Furthermore have you considered our communication layer approach [1]? With that you just need to programm the message payload generation in your own layer and can reuse much more 4diac FORTE code. Even our FBs. I guess in your case the publish and subscribe.
But coming back to your problem: Not seeing messages in wireshark can have several reasons: routing tables, not running loop back devices, firewall, networkswitch. Therefore it could be something totally outside of 4diac FORTE.
[1] https://www.eclipse.org/4diac/en_help.php?helppage=html/development/forte_communicationArchitecture.html
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02978 seconds