Watch Handle
tang
tzs at unication.com.cn
Sun Sep 18 20:07:06 PDT 2005
Jakub Piotr Cłapa wrote:
> tang wrote:
>
>> i am sorry ,
>>
>> the error message appear after i invoke
>> dbus_connection_send_with_reply_and_block();
>
>
> It means mostly what it says --- You are waiting for replies (one thing
> I don't understand is how do you send more than one message using the
> _block function) for more messages than you are allowed to. Maybe the
> remote end you are sending to somehow forgets to send replies?
>
thank you for your help!
yes, i need get the replies,
so i used dbus_connection_send_with_reply_and_block() to send a message,
this function mean: "Sends a message and blocks a certain time period
while waiting for a reply. ",
Is it blocked(does not return) when waiting for replies?
using dbus_connection_send_with_reply_and_block(),
when not receive the reply and block, if this function does not return,
why it associated with max_replies_per_connection limit?
my codes as the follows:
void InvokeAPI(const char* szCmd);
int main(int argc, char** argv)
{
...
// the code of testing like these
// the error message will appear when i step circa 30 times
for (i=0; i<50; i++)
{
InvokeAPI( "a string" );
sleep( 1 ); //sleep a second
}
...
}
void InvokeAPI(const char* szCmd)
{
DBusMessage *msg2;
DBusMessage *reply2;
DBusMessageIter reply2_iter;
msg2 = dbus_message_new_method_call("com.XXX.API", "/com/XXX",
"com.XXX.API", "Invoke");
dbus_message_append_args( msg2,
DBUS_TYPE_STRING,
szCmd, 0 );
dbus_message_set_auto_activation( msg2, TRUE );
dbus_error_init (&error);
try
{
reply2 = dbus_connection_send_with_reply_and_block( conn, msg2,
-1, &error );
dbus_connection_flush (conn);
}
catch(...)
{
medit->append( "abort in InvokeSkypeAPI()" );
}
if (dbus_error_is_set(&error))
{
medit->append( QString("%1,%2").arg(error.name)
.arg(error.message));
}
else
{
dbus_message_iter_init (reply2, &reply2_iter);
outputReply(&reply2_iter);
dbus_message_unref (reply2);
}
dbus_message_unref (msg2);
}
More information about the dbus
mailing list