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



From: Scott Klement

If you're reading into an RPG VARYING field you need to follow these
steps:

a) Set the field to it's maximum length before calling the recv() API.
Generally the code to do that looks like this:

%len(Field) = %size(Field) - 2;

Please realize that the magic number "2" may change in a future release of
the compiler. No need to rehash the entire discussion, but once VARYING
fields great than 64K are allowed, you may need to adjust this code. I hope
that the compiler folks will make sure that you can specify your D-specs in
such a way that existing code doesn't break.


b) Call the recv() API, but pass the address of the DATA, not the
address of the length. Basically, add 2 to the adddress. Typically,
you'd code it as follows:

len = recv(mySock: %addr(Field)+2: %len(Field): 0);

This is another place where the value 2 is only good "for now".


Also, I believe you can skip step A and just do this:

len = recv(mySock: %addr(Field)+2: %size(Field)-2: 0);

This way, you remove one line of code and you have the magic number two
isolated in one line.


Joe



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.