View Single Post
Old 17 October 2019, 09:10   #16
Registered User
thomas's Avatar
Join Date: Jan 2002
Location: Germany
Posts: 5,939
Actually it should work with two ports as llong as you don't confuse the messages.

Normally you have a client and server relation. The server creates a port for receiving requests and the client creates a port to receive replies.

You make a quite strange protocol with sending messages and replies in both directions. So you have to make sure that you properly distinct requests from replies. When you receive a reply you have to extract the result from the message and throw it away. When you receive a request you have to start processing and keep the message so that you can reply when the request has been processed.

If your program hangs you got it messed up. You wait for the wrong port or expect a reply when you sent a request or vice versa or something similar.

And of course you must not reuse a message which has not yet been replied to. Messages are not copied, only the pointer to the memory of the message is attached to the receiving port.
thomas is online now  
Page generated in 0.04245 seconds with 11 queries