I posted an example of how I use the UPOC protocol to communicate with our IBM mainframe via TCP/IP by having the UPOC invoke the appropriate application (TRHB) on the mainframe and then send it the FRL containing the textual transcription document.
Here is the URL of my post that includes most of the details you are looking for, including a copy of the code for my upoc_tran_client.tcl and NetConfig screen shots:
It even has logic in it that reads from the USERDATA metadata that gets set in another cloverleaf process during xlate to communcate to the outbound UPOC thread if the document was too large and has been truncated.
One thing to remember when doing UPOC that is significant, you assume the responsiblilities that the cloverleaf engine typically handles for you and have to code for those responsibilities.
Also remember if your UPOC has a sleep in it that it will sleep the entire process and any threads in that process.