I actually got a little lucky (it's only a moment in time). I can look for a </Message> that marks the end BUT I also will receive a 4 byte length signed integer in Big Endian format. Does this code to convert to a Clarion LONG look right:
FromBEndian PROCEDURE (STRING RawVal)!, LONG
ByteArray BYTE,DIM(4)
InputVal STRING(4),OVER(ByteArray)
Result LONG
CODE
InputVal = RawVal
Result = (INT(ByteArray[1]) * 256^3 + |
INT(ByteArray[2]) * 256^2 + |
INT(ByteArray[3]) * 256 + |
INT(ByteArray[4])) - 4
RETURN Result
Looking at the docs (late yesterday) this looks like a popular method for passing the length. It might be worth an option to support "big endian" format as a passed length for WholePacket
With the leading length a </Message> closing it should not be that hard.
If the server closes the connection before I give up what event will fire on my end? I know I have to probably do this a few more times with a few more clients and a few servers too. Some may be on a VPN but I think some others may be not. This one will be nice since I don't have to run my own client to poll for responses from prior requests but I figure that is coming too. This connection I just send over the request and then need to have a server wait a good long time for a response. They have to perform a phone call verification with a doctor so it's not very "real time". Mostly it just is matching up my requests with supplied responses and sending them back where they came from. This is basically just an "internet trucking" application delivering and receiving loads.
Are you aware of any standard response that is used from a server. I get the impression these folks don't want one.