You are viewing a plain text version of this content. The canonical link for it is here.
Posted to proton@qpid.apache.org by Sanny <sa...@gmail.com> on 2015/10/29 14:51:31 UTC

pn_error_code() returning -2 error

Hi,

Using Proton C library.

I am following the demo example "send.c" shared in the archive. Currently
using the mqx OS.


1. I have following function in *pn_error_code*(messenger->error); always
returning *-2*. while calling the following function*
pn_messenger_put*(messenger,
message);
2. In the following demo "send.c" when will the socket be open. As I see
following function "*pn_messenger_start*(messenger);" doesnt have any
significance , since
 if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*) *messenger->flags is
never **PN_FLAGS_CHECK_ROUTES.*

3. Is there any basic code flow document that i can refer to start of the
debug would be very helpful.


Thanks in Advance

Re: pn_error_code() returning -2 error

Posted by aconway <ac...@redhat.com>.
On Mon, 2015-11-09 at 17:12 +0530, Sanny wrote:
> Hi,
> 
> Using Proton C library.
> 
> I am following the demo example "send.c" shared in the archive.
> Currently
> using the mqx OS.
> 
> 
> 1. I have following function in *pn_error_code*(messenger->error);
> always
> returning *-2*. while calling the following function*
> pn_messenger_put*(messenger,
> message);
> 2. In the following demo "send.c" when will the socket be open. As I
> see
> following function "*pn_messenger_start*(messenger);" doesnt have any
> significance , since
>  if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*) *messenger->flags is
> never **PN_FLAGS_CHECK_ROUTES.*
> 
> 3. Is there any basic code flow document that i can refer to start of
> the
> debug would be very helpful.

You may want to consider the event-driven approach which is becoming
more popular than messenger. Messenger has some limitations
(particularly around error handling/reporting) and right now it appears
like more development is going into the more flexible event-driven
approach. The C doc for the event approach is limited



> 
> 
> Thanks in Advance
> 
> On Thu, Oct 29, 2015 at 7:21 PM, Sanny <sa...@gmail.com> wrote:
> 
> > Hi,
> > 
> > Using Proton C library.
> > 
> > I am following the demo example "send.c" shared in the archive.
> > Currently
> > using the mqx OS.
> > 
> > 
> > 1. I have following function in *pn_error_code*(messenger->error);
> > always
> > returning *-2*. while calling the following function*
> > pn_messenger_put*(messenger,
> > message);
> > 2. In the following demo "send.c" when will the socket be open. As
> > I see
> > following function "*pn_messenger_start*(messenger);" doesnt have
> > any
> > significance , since
> >  if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*) *messenger->flags
> > is
> > never **PN_FLAGS_CHECK_ROUTES.*
> > 
> > 3. Is there any basic code flow document that i can refer to start
> > of the
> > debug would be very helpful.
> > 
> > 
> > Thanks in Advance
> > 

Re: pn_error_code() returning -2 error

Posted by aconway <ac...@redhat.com>.
On Mon, 2015-11-09 at 17:12 +0530, Sanny wrote:
> Hi,
> 
> Using Proton C library.
> 
> I am following the demo example "send.c" shared in the archive.
> Currently
> using the mqx OS.
> 
> 
> 1. I have following function in *pn_error_code*(messenger->error);
> always
> returning *-2*. while calling the following function*
> pn_messenger_put*(messenger,
> message);
> 2. In the following demo "send.c" when will the socket be open. As I
> see
> following function "*pn_messenger_start*(messenger);" doesnt have any
> significance , since
>  if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*) *messenger->flags is
> never **PN_FLAGS_CHECK_ROUTES.*
> 
> 3. Is there any basic code flow document that i can refer to start of
> the
> debug would be very helpful.

[oops, just discovered a new keyboard shortcut for "send" while typing
this mail, will attempt to complete it now]

You may want to consider the event-driven approach which is becoming
more popular than messenger. Messenger has some limitations
(particularly around error handling/reporting) and right now it appears
like more development is going into the more flexible event-driven
approach. The C doc for the event approach is not good but there are 2
C examples `proton/tests/tools/apps/c/reactor-*.c`. The C++ and python
bindings have pretty good tutorials and examples and are very close
analogues to the C API so you can also work backwards from them.

On your original question: 

pn_error_text() may give you more of a clue about your error, -2 is
PN_ERR which only really tells you that proton doesn't have a specific
error code for whatever is going wrong.

The line "if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*)" means that
the checks are *always* run if *any* of messenger->flags are set so
that code might be an issue in your problem. 

(I believe the line is a proton bug, 
https://issues.apache.org/jira/browse/PROTON-1043)

> 
> 
> Thanks in Advance
> 
> On Thu, Oct 29, 2015 at 7:21 PM, Sanny <sa...@gmail.com> wrote:
> 
> > Hi,
> > 
> > Using Proton C library.
> > 
> > I am following the demo example "send.c" shared in the archive.
> > Currently
> > using the mqx OS.
> > 
> > 
> > 1. I have following function in *pn_error_code*(messenger->error);
> > always
> > returning *-2*. while calling the following function*
> > pn_messenger_put*(messenger,
> > message);
> > 2. In the following demo "send.c" when will the socket be open. As
> > I see
> > following function "*pn_messenger_start*(messenger);" doesnt have
> > any
> > significance , since
> >  if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*) *messenger->flags
> > is
> > never **PN_FLAGS_CHECK_ROUTES.*
> > 
> > 3. Is there any basic code flow document that i can refer to start
> > of the
> > debug would be very helpful.
> > 
> > 
> > Thanks in Advance

Re: pn_error_code() returning -2 error

Posted by aconway <ac...@redhat.com>.
On Mon, 2015-11-09 at 17:12 +0530, Sanny wrote:
> Hi,
> 
> Using Proton C library.
> 
> I am following the demo example "send.c" shared in the archive.
> Currently
> using the mqx OS.
> 
> 
> 1. I have following function in *pn_error_code*(messenger->error);
> always
> returning *-2*. while calling the following function*
> pn_messenger_put*(messenger,
> message);
> 2. In the following demo "send.c" when will the socket be open. As I
> see
> following function "*pn_messenger_start*(messenger);" doesnt have any
> significance , since
>  if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*) *messenger->flags is
> never **PN_FLAGS_CHECK_ROUTES.*
> 
> 3. Is there any basic code flow document that i can refer to start of
> the
> debug would be very helpful.

[oops, just discovered a new keyboard shortcut for "send" while typing
this mail, will attempt to complete it now]

You may want to consider the event-driven approach which is becoming
more popular than messenger. Messenger has some limitations
(particularly around error handling/reporting) and right now it appears
like more development is going into the more flexible event-driven
approach. The C doc for the event approach is not good but there are 2
C examples `proton/tests/tools/apps/c/reactor-*.c`. The C++ and python
bindings have pretty good tutorials and examples and are very close
analogues to the C API so you can also work backwards from them.

On your original question: 

pn_error_text() may give you more of a clue about your error, -2 is
PN_ERR which only really tells you that proton doesn't have a specific
error code for whatever is going wrong.

The line "if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*)" means that
the checks are *always* run if *any* of messenger->flags are set so
that code might be an issue in your problem. 

(I believe the line is a proton bug, 
https://issues.apache.org/jira/browse/PROTON-1043)

> 
> 
> Thanks in Advance
> 
> On Thu, Oct 29, 2015 at 7:21 PM, Sanny <sa...@gmail.com> wrote:
> 
> > Hi,
> > 
> > Using Proton C library.
> > 
> > I am following the demo example "send.c" shared in the archive.
> > Currently
> > using the mqx OS.
> > 
> > 
> > 1. I have following function in *pn_error_code*(messenger->error);
> > always
> > returning *-2*. while calling the following function*
> > pn_messenger_put*(messenger,
> > message);
> > 2. In the following demo "send.c" when will the socket be open. As
> > I see
> > following function "*pn_messenger_start*(messenger);" doesnt have
> > any
> > significance , since
> >  if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*) *messenger->flags
> > is
> > never **PN_FLAGS_CHECK_ROUTES.*
> > 
> > 3. Is there any basic code flow document that i can refer to start
> > of the
> > debug would be very helpful.
> > 
> > 
> > Thanks in Advance

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: pn_error_code() returning -2 error

Posted by aconway <ac...@redhat.com>.
On Mon, 2015-11-09 at 17:12 +0530, Sanny wrote:
> Hi,
> 
> Using Proton C library.
> 
> I am following the demo example "send.c" shared in the archive.
> Currently
> using the mqx OS.
> 
> 
> 1. I have following function in *pn_error_code*(messenger->error);
> always
> returning *-2*. while calling the following function*
> pn_messenger_put*(messenger,
> message);
> 2. In the following demo "send.c" when will the socket be open. As I
> see
> following function "*pn_messenger_start*(messenger);" doesnt have any
> significance , since
>  if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*) *messenger->flags is
> never **PN_FLAGS_CHECK_ROUTES.*
> 
> 3. Is there any basic code flow document that i can refer to start of
> the
> debug would be very helpful.

You may want to consider the event-driven approach which is becoming
more popular than messenger. Messenger has some limitations
(particularly around error handling/reporting) and right now it appears
like more development is going into the more flexible event-driven
approach. The C doc for the event approach is limited



> 
> 
> Thanks in Advance
> 
> On Thu, Oct 29, 2015 at 7:21 PM, Sanny <sa...@gmail.com> wrote:
> 
> > Hi,
> > 
> > Using Proton C library.
> > 
> > I am following the demo example "send.c" shared in the archive.
> > Currently
> > using the mqx OS.
> > 
> > 
> > 1. I have following function in *pn_error_code*(messenger->error);
> > always
> > returning *-2*. while calling the following function*
> > pn_messenger_put*(messenger,
> > message);
> > 2. In the following demo "send.c" when will the socket be open. As
> > I see
> > following function "*pn_messenger_start*(messenger);" doesnt have
> > any
> > significance , since
> >  if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*) *messenger->flags
> > is
> > never **PN_FLAGS_CHECK_ROUTES.*
> > 
> > 3. Is there any basic code flow document that i can refer to start
> > of the
> > debug would be very helpful.
> > 
> > 
> > Thanks in Advance
> > 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: pn_error_code() returning -2 error

Posted by Sanny <sa...@gmail.com>.
Hi,

Using Proton C library.

I am following the demo example "send.c" shared in the archive. Currently
using the mqx OS.


1. I have following function in *pn_error_code*(messenger->error); always
returning *-2*. while calling the following function*
pn_messenger_put*(messenger,
message);
2. In the following demo "send.c" when will the socket be open. As I see
following function "*pn_messenger_start*(messenger);" doesnt have any
significance , since
 if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*) *messenger->flags is
never **PN_FLAGS_CHECK_ROUTES.*

3. Is there any basic code flow document that i can refer to start of the
debug would be very helpful.


Thanks in Advance

On Thu, Oct 29, 2015 at 7:21 PM, Sanny <sa...@gmail.com> wrote:

> Hi,
>
> Using Proton C library.
>
> I am following the demo example "send.c" shared in the archive. Currently
> using the mqx OS.
>
>
> 1. I have following function in *pn_error_code*(messenger->error); always
> returning *-2*. while calling the following function* pn_messenger_put*(messenger,
> message);
> 2. In the following demo "send.c" when will the socket be open. As I see
> following function "*pn_messenger_start*(messenger);" doesnt have any
> significance , since
>  if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*) *messenger->flags is
> never **PN_FLAGS_CHECK_ROUTES.*
>
> 3. Is there any basic code flow document that i can refer to start of the
> debug would be very helpful.
>
>
> Thanks in Advance
>

Re: pn_error_code() returning -2 error

Posted by Sanny <sa...@gmail.com>.
Hi,

Using Proton C library.

I am following the demo example "send.c" shared in the archive. Currently
using the mqx OS.


1. I have following function in *pn_error_code*(messenger->error); always
returning *-2*. while calling the following function*
pn_messenger_put*(messenger,
message);
2. In the following demo "send.c" when will the socket be open. As I see
following function "*pn_messenger_start*(messenger);" doesnt have any
significance , since
 if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*) *messenger->flags is
never **PN_FLAGS_CHECK_ROUTES.*

3. Is there any basic code flow document that i can refer to start of the
debug would be very helpful.


Thanks in Advance

On Thu, Oct 29, 2015 at 7:21 PM, Sanny <sa...@gmail.com> wrote:

> Hi,
>
> Using Proton C library.
>
> I am following the demo example "send.c" shared in the archive. Currently
> using the mqx OS.
>
>
> 1. I have following function in *pn_error_code*(messenger->error); always
> returning *-2*. while calling the following function* pn_messenger_put*(messenger,
> message);
> 2. In the following demo "send.c" when will the socket be open. As I see
> following function "*pn_messenger_start*(messenger);" doesnt have any
> significance , since
>  if (*messenger->flags | PN_FLAGS_CHECK_ROUTES*) *messenger->flags is
> never **PN_FLAGS_CHECK_ROUTES.*
>
> 3. Is there any basic code flow document that i can refer to start of the
> debug would be very helpful.
>
>
> Thanks in Advance
>