Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » custom UDP messages(problem while creating a SIFB to send out UDP message)
custom UDP messages [message #1818556] Thu, 19 December 2019 14:35 Go to next message
Niklas Huhs is currently offline Niklas HuhsFriend
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 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1582
Registered: January 2014
Senior Member

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
Re: custom UDP messages [message #1818589 is a reply to message #1818569] Fri, 20 December 2019 08:41 Go to previous messageGo to next message
Niklas Huhs is currently offline Niklas HuhsFriend
Messages: 32
Registered: October 2019
Member
Thanks for your answer.
I considered it but thought it might be easier and faster to program two blocks to do the job. But I guess in the end it might be less work to use the communication layer approach so I think I will use that one again.
Re: custom UDP messages [message #1818611 is a reply to message #1818589] Fri, 20 December 2019 14:42 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1582
Registered: January 2014
Senior Member

You can have a look on the raw layer as starting point for your own encoding.
Previous Topic:Integrating LUA with Docker
Next Topic:Raspberry forte 's debugging problem
Goto Forum:
  


Current Time: Thu Apr 18 20:18:56 GMT 2024

Powered by FUDForum. Page generated in 0.02088 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top