× 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.



It is interesting if these functions work, because I had thought they were
no-op'd on the iSeries.

-Bob Cozzi
www.iSeriesTV.com
iPod your industry news instead of reading it.
Coming July 18, 2006
Ask your friends to tune into iSeriesTV.com

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Behalf Of Eduard Sluis
Sent: Tuesday, June 27, 2006 11:51 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: OSG and (DataLink NT) CSMS communication from iSeries?

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 ...

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.