× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Alan,
   
  Thanks. I guess you have answered my question.
   
  Indeed the documentation mentions C functions to do the conversion.
  Would however not have known which.
  Perhaps a shame because my original background is C........
   
  Kind regards,
  Eduard Sluis
  
"Alan G. Campin" <agc@xxxxxxxxxxxxxxxxxxxx> wrote:
  If that is all there is, that is not much. 

I have used 2 and 4 byte headers before and they are very nice. But like
they say, the only trick is that you need to convert from the Network
byte order to the Host byte order.

"C" function ntohl converts from a long integer in network byte order to
host byte order (The AS/400). My StdIntUns is standard integer 4 bytes
long unsigned. 

d ConvertLongToHostAPI...
d pr ExtProc('ntohl')
d Like(StdIntUns)
d PR_IntegerInNetworkOrder...
d Like(StdIntIns)
/Free

// Read in 4 bytes as integer. Then convert to host order and read
number of bytes from header. 
CharactersRead = ReadAPI(Handle, %Addr(NetworkInteger), 4);

HostInteger = ConvertLongToHostAPI(NetworkInteger); 

CharactersRead = ReadAPI(Handle, %Addr(Buffer), HostInteger);

/End-Free

No guarantee on any of this code. Just doing from top of my head. 

Htonl takes it back the other way. 

I hope I am answering your question. 

------------------------------------------------------------------------
------------------------
From the documentation I have derived that OSG has certain specifics
in the 
data sent (First Four Bytes depicts the length of the data
send/recieved in 
'network integer format') that are less common in normal Socket
communication 
and that perhaps require special conversion.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.