With any interface their should be an PLC to Host interface specification. You might want to get ahold of this or maybe its your responsible for creating it. Your question is very broad, not sure what your asking for.
Once you have created this document then you should be able to write code to this interface.
Most PLC to Host Hardware Interfaces for PLC5 are either the dated DH+ or more up to date Ethernet/IP.
Most of the messaging back and forth has a header (what message is this) content (what info are you passing) acknowledge the message (some way to verify it got to its destination)