Zurück zu Willert.de

socket communication problem with send operator

Rhapsody Model or Codegeneration topics

socket communication problem with send operator

Postby little83 » March 2nd, 2012, 12:53 am


I am developing a model for an application which sends commands and receive messages to/from a hardware equipment which has an IP and port number. The messages uses TCP protocol. I use the headers winsock2.h, WS2tcpip and the library ws2_32.lib. The send function in my model shows the following compiling error:

Comm.cpp(519) : error C2661: 'OMReactive::send' : no overloaded function takes 4 arguments

The application creates the connection between my laptop and the the hardware equipment and can receive message with no problem. However, when I insert the send function, it display the shown error above. Apparently, there is "send" function in rhapsody system files. So how can refer to the send function defined in winsock2.h header.

I am using rhapsody 7.6.1 and generating c++ code.

Posts: 14
Joined: January 10th, 2012, 11:23 pm

Re: socket communication problem with send operator

Postby DjCisco » November 25th, 2013, 4:20 pm

Hi John,

the problem is that you are using a function called "send" which is part of the socket communictaion within a OMReactive Class (that is a class that has a state chart).

There is a name conflict because the OMReactive Class already contains a function called "send" which cannnot be overriden.

I enconutered these problem in a previous model that I built , and solved it by placing the "send" function of the socket communication in another class that does not contain a statechart.

I will search for the example , and post it later


Posts: 4
Joined: June 28th, 2011, 9:07 pm

Re: socket communication problem with send operator

Postby shanz » November 26th, 2013, 1:26 pm

I think this should work assuming the winsock library is included properly and that the winsock send() has a different number of arguments to the oxf's send() methods. Can you call other winsock methods OK?
Posts: 178
Joined: May 7th, 2008, 5:50 pm
Location: Horsham, W Sussex, England

Re: socket communication problem with send operator

Postby fsjunior » November 26th, 2013, 6:17 pm

I think that the problem is that no one use OMReactive::send function directly, using only GEN macros to send events. This transforms the "send" method "invisible" and hard to understand why "send" function doesn't work properly.

Fortunately, you can use a much simple solution to override this. Call the send socket function with scope resolution operator :: to specify that the send function that you're calling is out of the class scope:

::send(/*Your params*/);
Posts: 19
Joined: March 22nd, 2013, 8:15 pm

Return to Modelling with Rhapsody

Who is online

Users browsing this forum: No registered users and 4 guests