Simple Concept. I have a string on computer A, I want it moved to computer B, how to do it, why is it so complex :)
I am setting up a program I need to run on multiple PC's where the different nodes needs to communicate. What needs to be sent is a text string (a command object that has been serialized to a string). Some of these nodes might be "clients" behind a firewall so how do they initiate two-way communication so they can receive information back once connected up?
My expectations would be that seen outside this transfer part that you have an entry point and a pickup point. Following is how I see the pseudocode, but I simply do not understand network coding well enough to figure out how it actually works to get it right. So far my searching has left me with code I do not understand what does, or the idea behind. (see questions after code)
public void SendCommand(String commandObject, String targetService)
{
<lookup service address>
<connect to address> || <connect to address if not already connected>
<send string>
<close connection> || <keep connection open>
}
public List<String> GetCommands()
{
<Grab Mutex on Outbox>
<Copy Outbox to tmpList>
<empty Outbox List>
<release Mutex>
<return tmpList>
}
??? how to handle this
<accept connection>
<receive string and move it to local buffer List<String> DropOff>
<get mutex via (waitOne(0)) for access to List<String> Outbox
<move DropOff entries to Outbox>
<empty DropOff>
<release Mutex>
Here my understanding fails.
*I do not understand how the Receive part of the network code is, and get the entry into the "DropOff" in a way that does not risk issues with multiple threads (hence idea of DropOff and Outbox in this code, is this already handled?)
*I do not understand how to setup a client to connect to this network layer in a way so twoway communication can occour. (Here I do understand its both computers having a listener and a way to send to the others sender, but if the listener on the Client computer is behind a firewall, how do I send replies and setup this listener once connection between the two computers have been established?)
I believe these are questions that have been asked quite a few times before, but I simply do not understand this well enough to know what to search for to get the required understanding. If you could direct me to this, and also help my understanding if my understanding of the pseudo code setup is wrong, please do so.