I have a single-threaded process which creates a channel and then registers it with gns via name_open(). Now I need to create a connection to the channel from the same process. I have not been able to do this. When I call name_open() the call hangs indefinitely. When I try to use ConnectAttach() I get error ESRCH back. Why does ConnectAttach() hang?
The problem with the test case is that upon connecting to yourself (server calls name_open in the name it just attached) you must be able to receive and reply to the IO_CONNECT message that is generated by the connection attempt.
The resmgr framework sends the IO_CONNECT message to the server as per the documentation for name_open:
In the past, when an application used name_open() to connect to a service, the server wasn't notified. Now, an _IO_CONNECT message with a subtype of _IO_CONNECT_OPEN is sent to the server. The server application must be able handle this message. For an example, see the documentation for name_attach().
Your server must be able to call MsgReceive to get that message AND respond to it (MsgReply or MsgError). The way you've written your program necessitates multiple threads - this won't be possible with just one thread.
NOTE:
This entry has been validated against the SDP version listed above. Use
caution when considering this advice for any other SDP version. For
supported releases, please reach out toQNX Technical Support if you have any questions/concerns.
Please contact us with your questions or concerns.
BlackBerry uses cookies to help make our website better. Some of the cookies are necessary for the proper functioning of the website while others, non-essential cookies, are used to better understand how you interact with our website and to make it better.