Moin, moin,
I have a reliability problem on receiving messages and I am running out of how
to debug that.
The communication use the multicast mode (from the multicast-demo). The
receivers running in different threads with set filters to separate the
messages. In general this works really good.
But sometimes (each 5th to 10th program start) after a few messages were
successfully received, no new messages from one type will reach the receiver.
If the receiver has set filters for more then on type, it is still possible to
receive the other messages.
When I start this receiver a second time (parallel to the already running
process), then the new receiver gets the messages, while the old one still does
not get the message.
I checked on the set filters with 'tipc-config --nt' and everything is in place.
An 'tipc-config -log' results in a 'log is empty'-prompt.
At the moment I do not know what to make next to get right of the problem.
Perhaps something is wrong in socket-handling, so please have a look:
Thank you
Martin Rosekeit
// transmitter ---------------------------------------------------------
void
TipcTransmitterSocket::transmitPayload( unsigned int typeId,
unsigned int instanceId,
char* payloadPointer,
size_t length)
{
int sendToResult = 0;
sockaddr_tipc tipcToAddresse;
// Initialize the toAddress struct of TIPC. For further documentation have
a look
// into the Multicast-Demo which is included into the TIPC-Demo package.
tipcToAddresse.family = AF_TIPC;
tipcToAddresse.addrtype = TIPC_ADDR_MCAST;
tipcToAddresse.addr.nameseq.type = typeId;
tipcToAddresse.addr.name.domain = 0;
tipcToAddresse.addr.nameseq.lower = instanceId;
tipcToAddresse.addr.nameseq.upper = instanceId;
sendToResult = sendto( this->socketDescriptor_,
(void*)payloadPointer,
length,
0,
(struct sockaddr*)&tipcToAddresse,
(size_t)sizeof(tipcToAddresse));
// Check if the sending failed
if (sendToResult < 0) {
std::cerr << "\nERROR in TipcTransmitterSocket::transmitPayload() on
transmit.";
}
}
// receiver --------------------------------------------------------
// The methode receive() is called two times and then pop().
void
TipcReceiverSocket::registerOnPacket( unsigned int typeId,
unsigned int lowerInstance,
unsigned int upperInstance)
{
int result = 0;
struct sockaddr_tipc fromAddress;
fromAddress.family = AF_TIPC;
fromAddress.addrtype = TIPC_ADDR_NAMESEQ;
fromAddress.addr.nameseq.type = typeId;
fromAddress.addr.nameseq.lower = lowerInstance;
fromAddress.addr.nameseq.upper = upperInstance;
fromAddress.scope = TIPC_CLUSTER_SCOPE; // Scope of puplisching
is cluster (node < cluster < zone)
// Binding means registering to a specific packet
result = bind ( this->socketDescriptor_,
(struct sockaddr*)&fromAddress,
sizeof(sockaddr_tipc) );
if (0 != result) {
printf("Port {%u,%u,%u} could not be created\n",
fromAddress.addr.nameseq.type,
fromAddress.addr.nameseq.lower,
fromAddress.addr.nameseq.upper);
}
}
// from TIPC-Demo, benchmark/client_tipc.c ( wait_for_msg() )
bool
TipcReceiverSocket::isPacketAvailable()
{
int result = 0;
struct pollfd pfd;
pfd.fd = this->socketDescriptor_;
pfd.events = ~POLLOUT;
result = poll( &pfd,
1,
0 // do not wait
);
return (result > 0);
}
bool
TipcReceiverSocket::receive(char* ptr, size_t payloadLength)
{
if ( this->isPacketAvailable() ) {
int result = 0;
result = recv( this->socketDescriptor_,
ptr,
payloadLength,
MSG_PEEK); // Do not delete data from TIPC
if( result > 0 ) {
return true;
}
else {
std::cerr << "\nERROR: TipcReceiverSocket::receivePayload()";
}
}
return false;
}
// This method removes the current packet from the TIPC message queue.
bool
TipcReceiverSocket::pop()
{
int result = 0;
if ( this->isPacketAvailable() ) {
char c; // TODO: Better way?
result = recv( this->socketDescriptor_,
&c, // We need no space for data
1, // We read no data
0); // Delete data from TIPC
return true;
}
return false;
}
--
<<Experience is what you get, when you don't get what you want.>>
Martin Rosekeit
Karlstraße 9
27607 Langen
Germany
Phone: +49 (0)4743 5857
Mobil: +49 (0)160 92505707
ICQ: 153 913 172 (Thundernail)
Jabber: [EMAIL PROTECTED]
Skype: thundernail
www.thundernail.de
www.ring1.de
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
tipc-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tipc-discussion