Yes, sorry for overlooking that.
I have a few general questions more about understanding and extending this concept.
This is a rather simple proof of concept, the final implementation would involve the rpc function being called from multiple different places, possibly simultaneously, in this case I want the caller to wait until its response is ready, when it is it should grab it and go on, while the other callers continue to wait.
In Pseudo code it would be some thing like this:
function rpc
do thread and queueing stuff in here
end rpc
function blah
rpc(IP, port2, command)
look at queue see if your result is there
if it is not
wait
else
do other stuff with the info
end blah
function blee
rpc(IP, port1, command)
look at queue see if your result is there
if it is not
wait
else
do other stuff with the info
end blah
These function may very well call rpc at the same time, they will always use different port numbers. How would I go about using the queue to determine if my information is back, since in each instance of the call I won't know how many ports I have open, it only knows about the port it was told to use. Should I dequeue check the port/result and if it doesn't match enqueue it again?
I really appreciate all your help.
|