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.
Please contact us with your questions or concerns.