I'm attempting to interact with a Win32 service/program via an RPG program using sockets. I found something a little strange that I cannot seem to resolve. If I define the receive buffer as anything longer than char(4343), I get an ECONNRESET error.
The response will contain a raw text message followed immediately by xml. The raw text message contains the length of the response. My problem is, if I change senddata to char(4343), and the recv() is successful, the response "can" come back with a length greater than 4343. Any thoughts?
Code:
dcl-s senddata char(4345); dcl-s recvdata like(senddata); // QTCPEBC translates from ascii to ebcdic // QTCPASC translates from ebcdic to ascii translate(%len(senddata):senddata:'QTCPASC'); // send request through socket rc = send( s : %addr( senddata ) : %len(senddata) : 0 ); rc = recv( s : %addr( recvdata ) : %len(recvdata) : 0 ); if rc <= 0; msg = %str(strerror(errno)); else; translate(%len(recvdata):recvdata:'QTCPEBC'); endif;
Comment