39 #include <NetworkComm/CScommServer.hh>
40 #include <Base/Common/W32Compat.hh>
44 int main (
int ,
char** )
58 string msg=
"LPOSHEAD";
64 vector<int> ints,intMsg;
71 vector<float> recFloats;
72 std::vector<char> binData(8);
88 if (server.
GetData(msg, recFloats)==0) {
89 cout<<
"New Data from client:"<<endl;
90 for (
unsigned int i=0;i<recFloats.size();i++)
91 cout<<recFloats[i]<<
" ";
97 if (server.
GetData(msg, ints)==0) {
98 cout<<
"New Data from client:"<<endl;
99 for (
unsigned int i=0;i<ints.size();i++)
104 server.
SendMsg(
"exampleClient",
"BINDATA",&binData[0],binData.size());
107 server.
SendMsg(
"RPOSHEAD",intMsg);
int RegisterMsg(std::string msgName, EdataType dataType, int amount=1)
only registered msgs are accepted by commPartners Register a msg with this functions.
void WaitForConnections(unsigned int port=D_CS_DEFAULT_PORT)
Init function, returns instantly and enables the server to accept connections on the given port ...
void SetVerbose(bool on)
gives some information about establising conn, and disconnecting etc.
class for sending/receiving data between clients and serversOnly registered msgs will be accepted at ...
int SendMsg(const std::string &msgName, std::vector< float > &floatData)
sends msg msgName to all connected commPartners.
int GetData(const std::string &msgName, std::vector< float > &floatData)
returns instantly:<br> 0 if new data has arrived and the data in xxxData 1 if no new data has arri...