Martin Politick
|
No _IO_CONNECT not being sent to server on name_open()
|
Martin Politick
05/08/2009 4:53 PM
post29090
|
No _IO_CONNECT not being sent to server on name_open()
Dev: Momentics 6.5.0
Target OS: 6.4.0
I have a server that uses name_attach( NULL, "MyName", 0);
then in the goes into its MsgReceive() loop.
I have a client that calls name_open( "MyName", 0 );
then starts exchanging with the server using that coid.
The server receives:
-All messages sent from the client
-All pulse code sent to it
-_PULSE_CODE_DISCONNECT when the client dies
But it DOES NOT EVER receive the _IO_CONNECT message.
According to the doc, since version 6.3, my server should receive
the _IO_CONNECT.
What can go wrong?
|
|
|
Jeevan Mathew(deleted)
|
Re: No _IO_CONNECT not being sent to server on name_open()
|
Jeevan Mathew(deleted)
05/11/2009 3:54 AM
post29123
|
Re: No _IO_CONNECT not being sent to server on name_open()
> Dev: Momentics 6.5.0
> Target OS: 6.4.0
>
> I have a server that uses name_attach( NULL, "MyName", 0);
> then in the goes into its MsgReceive() loop.
>
> I have a client that calls name_open( "MyName", 0 );
> then starts exchanging with the server using that coid.
>
> The server receives:
> -All messages sent from the client
> -All pulse code sent to it
> -_PULSE_CODE_DISCONNECT when the client dies
>
> But it DOES NOT EVER receive the _IO_CONNECT message.
> According to the doc, since version 6.3, my server should receive
> the _IO_CONNECT.
>
> What can go wrong?
>
Not much.
You should get that message when you are using the NAME_FLAG_ATTACH_GLOBAL to name_open/name_attach for doing this over
the QNX network.
Hope this helps.
Jeevan
|
|
|
Thomas Haupt
|
RE: No _IO_CONNECT not being sent to server on name_open()
|
Thomas Haupt
05/11/2009 5:05 AM
post29126
|
RE: No _IO_CONNECT not being sent to server on name_open()
You'll receive the IO_CONNECT message only if the global name server,
"gns" is running.
If it is running, IO_CONNECT will be received both when a local and when
a global name is attached.
- Thomas
> -----Original Message-----
> From: Jeevan Mathew [mailto:community-noreply@qnx.com]
> Sent: 11 May 2009 09:55
> To: momenticsgs-community
> Subject: Re: No _IO_CONNECT not being sent to server on name_open()
>
> > Dev: Momentics 6.5.0
> > Target OS: 6.4.0
> >
> > I have a server that uses name_attach( NULL, "MyName", 0); then in
> > the goes into its MsgReceive() loop.
> >
> > I have a client that calls name_open( "MyName", 0 ); then starts
> > exchanging with the server using that coid.
> >
> > The server receives:
> > -All messages sent from the client
> > -All pulse code sent to it
> > -_PULSE_CODE_DISCONNECT when the client dies
> >
> > But it DOES NOT EVER receive the _IO_CONNECT message.
> > According to the doc, since version 6.3, my server should
> receive the
> > _IO_CONNECT.
> >
> > What can go wrong?
> >
>
> Not much.
>
> You should get that message when you are using the
> NAME_FLAG_ATTACH_GLOBAL to name_open/name_attach for doing
> this over the QNX network.
>
> Hope this helps.
> Jeevan
>
>
>
> _______________________________________________
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post29123
>
>
|
|
|
Nick Tyler
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
|
Nick Tyler
05/11/2009 11:21 AM
post29167
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
Interesting...
I am just getting started with QNX and bumped into the self-same thing last Friday.
Now...how to defensively write code that knows whether or not to wait on the client calling name_attach()? Do I have to
look for gns in name space first?
And, are there many other gotcha's like this one?
Thanks
|
|
|
Martin Politick
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
|
Martin Politick
05/11/2009 7:05 PM
post29213
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
The documentation:
http://www.qnx.com/developers/docs/6.4.0/neutrino/lib_ref/n/name_attach.html#id9
Does not say that gns is required to enable receiving _IO_CONNECT.
Also the EXAMPLE in name_attach() attaches a LOCAL name while has code to receive the _IO_CONNECT
It does not feel natural to receive _IO_CONNECT only when gns is running. And receiving that _IO_CONNECT on an
name_open() makes the implementation much cleaner.
I don't know if it is, but it feels like a bug to me.
QSSL, Officially, how is this supposed to work?
|
|
|
Martin Politick
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
|
Martin Politick
05/13/2009 1:00 AM
post29327
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
Thomas Haupt is right,
running gns does enable receiving the _IO_CONNECT
both using local or global names.
But I also agree with Nick Tyler, this behavior is the worse of both worlds because it behaves differently if an
external server (gns) is running or not.
This mean can't just ignore the _IO_CONNECT because my clients will block if gns is running so I need to add:
case _IO_CONNECT:
{
// Code SNIP
if( i==MAX_CLIENT )
{
MsgError( ReceiveID, EACCES );
}
else
{
//// must EOK to allow connection.
MsgReply( ReceiveID, EOK, NULL, 0 );
}
break;
}
But yet I can't rely on this behavior to detect new client connections if gns is not running.
|
|
|
Deniz Eren(deleted)
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
|
Deniz Eren(deleted)
05/13/2014 1:35 AM
post110288
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
Hi,
Has this issue been resolved yet? I'm experiencing the exact same thing.
I don't have "gns" running, so should I just ignore this _IO_CONNECT message?
Best regards,
Deniz
|
|
|
Dave Nickerson
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
|
Dave Nickerson
05/23/2014 1:36 PM
post110477
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
This is the correct behaviour, _IO_CONNECT is only received when gns is running.
The current recommendation is to check for message type when a message is received, if it is an _IO_CONNECT message,
reply to it with an EOK, no data to allow the connect to succeed. After that message is handled, go back to your
Msg_Receive() , your message from that client will be waiting (possibly with messages from other clients as well).
If you know that you will never do message passing over the QNET network (and gns will not be running), then you can
ignore the _IO_CONNECT message.
The 6.6.0 documentation has been clarified for this behaviour.
Dave
|
|
|
Egor Litvinov(deleted)
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
|
Egor Litvinov(deleted)
10/09/2014 3:07 AM
post111998
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
Hello.
I have a similar problem, but my server don't receive _PULSE_CODE_DISCONNECT.
server:
attach = name_attach(NULL, ATTACH_POINT, 0);
ChannelDestroy(attach->chid); // here I try to set flag "_NTO_CHF_DISCONNECT"
attach->chid = ChannelCreate(_NTO_CHF_DISCONNECT)
while ( 1 )
{
rcvid = MsgReceive()
if ( rcvid == -1)
{}
else if ( rcvid == 0 )
{
switch ( RxMsg.Mypulse.code)
{
case 0:
// pulse from timre; it is work
case _PULSE_CODE_DISCONNECT:
// doesn't work
}
else
{
// parsing message, it is work
}
}
client:
server_coid = name_open(ATTACH_POINT, 0)
while ( <condition> )
{
status = MsgSend()
}
name_close(server_coid);
// when executed this line, server don't receive _PULSE_CODE_DISCONNECT
Moreover, I try why running "gns" and whiout it.
Anybody know how it is possible to decide this problem?
THANK YOU VERY MUCH
|
|
|
Dave Nickerson
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
|
Dave Nickerson
10/09/2014 2:33 PM
post112012
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
By default name_attach () creates a channel with three flags set, one is the _NTO_CHF_DISCONNECT
Remove the ChannelDestroy and the ChannelCreate call from your code and you should be goog.
> Hello.
>
> I have a similar problem, but my server don't receive _PULSE_CODE_DISCONNECT.
>
> server:
> attach = name_attach(NULL, ATTACH_POINT, 0);
> ChannelDestroy(attach->chid); // here I try to set flag "
> _NTO_CHF_DISCONNECT"
> attach->chid = ChannelCreate(_NTO_CHF_DISCONNECT)
> while ( 1 )
> {
> rcvid = MsgReceive()
> if ( rcvid == -1)
> {}
> else if ( rcvid == 0 )
> {
> switch ( RxMsg.Mypulse.code)
> {
> case 0:
> // pulse from timre; it is work
> case _PULSE_CODE_DISCONNECT:
> // doesn't work
> }
> else
> {
> // parsing message, it is work
> }
> }
>
> client:
> server_coid = name_open(ATTACH_POINT, 0)
> while ( <condition> )
> {
> status = MsgSend()
> }
> name_close(server_coid);
> // when executed this line, server don't receive _PULSE_CODE_DISCONNECT
>
> Moreover, I try why running "gns" and whiout it.
>
> Anybody know how it is possible to decide this problem?
>
> THANK YOU VERY MUCH
|
|
|
Egor Litvinov(deleted)
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
|
Egor Litvinov(deleted)
10/14/2014 2:10 AM
post112040
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
Thank you very much Dave Nickerson.
Now I have next problem:
some clients connect to server (each client uses name_open() that set connecton to the server)
then if the client disconnect from server (use name_close() ) I don't receive _PULSE_CODE_DISCONNECT.
I receive this pulse only when last client disconnect. i.e.
client 1 connect - OK
client 2 connect - OK
client 3 connect - OK
client 3 disconnect - have not _PULSE_CODE_DISCONNECT
client 2 disconnect - have not _PULSE_CODE_DISCONNECT
client 1 disconnect - have _PULSE_CODE_DISCONNECT
Although in this site http://www.qnx.com/developers/docs/6.5.0/index.jsp
the article about name_attach() says:
" case _PULSE_CODE_DISCONNECT:
/*
* A client disconnected all its connections (called
* name_close() for each name_open() of our name) or
* terminated
*/"
I correct understand that each time when I call "name_close()" will be generate _PULSE_CODE_DISCONNECT?
or I am wrong?
Thank you
|
|
|
Dave Nickerson
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
|
Dave Nickerson
10/15/2014 2:41 PM
post112050
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
You would not get a disconnect pulse until all connections from a client process are closed. So not from each
ConnectDetach() but when ConnectDetach() is called for the last coid between the client process and the server process.
|
|
|
Dave Nickerson
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
|
Dave Nickerson
10/15/2014 2:46 PM
post112052
|
Re: RE: No _IO_CONNECT not being sent to server on name_open()
Or in the case of name_close(), when the last name has been closed between the client process and the server process.
Each name_open() from the client process to a name that is serviced by the same server process represents a connection
(coid) and a client-server relationship between the client process and the server process. Only when all the client-
server relationships between the client and server have been severed, will the disconnect pulse be sent by the kernel.
Hope that makes sense.
|
|
|
|