I want to use the "PAC .NET OptoMMP SDK" to talk to the ScratchPad on SoftPAC. My goal is for my Windows program to write to and read from the Scratch Pad on SoftPAC, which I understand is the way to do it with SoftPAC and MMP - the ScratchPad is the only are accessible via MMP on a SoftPAC.
I wrote a Windows program in C++ and have added "OptoMMP3.dll" as a Resource. I can instantiate an OptoMMP object with no errors, and would like to "Open()" it and start sending/receiving scratch pad data using the Scratch Pad commands for OptoMMP. Given the examples that are provided, after instantiating the OptoMMP object, I use the following command to open the connection to the scratchpad on my SoftPAC:
result = m_pMmpObj->Open( "10.0.10.10", 22001, OptoMMP::Connection::UdpIp,3000,true );
Thing is, I'm getting errors. Like -2, -10, -11 and such, and sometimes "bCommFault" and "bProtocolFault" when I call GetExtended ErrorInformation().
I'm a little confused on how to set up the SoftPAC so I must be doing something wrong. My understanding is I need to add an "I/O Unit" of type "Generic OptoMMP Device", so based on the instructions in document 1704, I launched Pad Manager, created an I/O unit like this. For the IP address, rather than use the loopback address I used a the static IP I assigned to my SoftPAC. 10.0.10.10. I arbitrarily chose the port 22001. I launch PAC Control Pro, open my Strategy, set the Strategy up to use SoftPAC as it's Control Unit. Run the strategy. I then launch my Windows program and execute the command above, but get the results I mentioned.
- Do I need to also create an I/O Unit in the Strategy that's of type "Generic OptoMMP Device"??
- Do I need to do anything in the Strategy running on SoftPAC to get it to connect via MMP?
- Does it matter if I use UPD or TCP/IP?
- Is there a specific port number I need to use?
- SoftPAC runs and I can access it at "10.0.10.10" with Pac Manager.
If there's anything else I'm obviously doing wrong, please let me know.