|
Look at how Scott Klement sends an unlimited amount of data to a socket in his HTTPAPI http_post_url (http://scottklement.com). I use that API to send XML data that I load into a *USRSPC and I just provide a pointer to where the data starts. To read a large amount _from_ a socket try also putting it into a *USRSPC by using a variable with a BASED pointer. I have provided the code below to do it from a CGI perspective. Note that it is not complete (missing modules) but you should get the general idea. I have tested this up to 11MB of data and it works fine. P CGI_readToUsrSpc... P B EXPORT D CGI_readToUsrSpc... D PI D pUsrSpc Value LikeDS(UsrSpc_UsrSpcInfo) D error DS LikeDS(gAPIError) D bytesRead S 10I 0 D contentLength S 10I 0 D data S 32767A Based(usrSpcPtr) D usrSpcPtr S * D errTxt S 32700A /Free error.bytesProvided = %Size(error); Monitor; contentLength = %Int(CGI_getEnvVar(CONTENT_LENGTH)); // Create the space needed for the standard input data by making use of // user spaces. UsrSpc_create( pUsrSpc.lib: pUsrSpc.name: ' ': contentLength: ' ': '*ALL': ' ': '*YES'); usrSpcPtr = UsrSpc_retrievePointer(pUsrSpc.lib: pUsrSpc.name); qtmhRdStin(data: contentLength: bytesRead: error); If error.msgId <> ' '; errTxt = 'Error reading Standard Input.'; Error_throwError('XML0000001': 100: 'CGI_readToUsrSpc': errTxt); EndIf; On-Error; errTxt = 'Error reading Standard Input.'; Error_throwError('XML0000001': 100: 'CGI_readToUsrSpc': errTxt); EndMon; Return; /End-Free P CGI_readToUsrSpc... P E HTH, Aaron Bartell
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.