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



Hmmm....wonder if you sent something that wasn't null (x'00').

On Fri, 4 Jun 2004 08:23:48 -0700 (PDT), "EDoxtator" <doc6502@xxxxxxxxx>
said:
> Hi All
> 
> I've got an issue with a ILE RPG sockets program (V5R2M0) that I don't
> quite
> understand.
> 
> The scenario is this:
> 
> 1. I have a program on the 400 that wakes up and connects to a TCP
> connection
> on a PC.  The PC is doing its comms through a Visual Basic program
> listening on
> an agreed port.  The connection works just fine-- the 400 successfully
> connects
> to the port.
> 
> 2. The 400 sends a request to the PC.  The PC receives the request, and
> logs it
> to a text box control.
> 
> 3. PC around and sends an acknowlegement to the 400 that it's received
> the
> data.  The acknowledgement is an 8-bit binary zero value (x'00', or &H0
> for you
> Visual Basic fans).  The send works just fine.  
> 
> 4. I do the recv() on the AS/400 to receive the acknowledgement as
> follows:
> 
>   rc = recv( piSocket, %addr( piBuffer ): %len( piBuffer): 0 );
>   
> However, no data is received.  By "no data received", rc is zero.
> 
> This makes no sense to me.  As I understand it, the socket I have created
> is a
> blocking socket.  If this is the case, then why does my recv() read data
> from
> the line, and then return zero?  I thought if you read a blocking socket,
> the
> program waited on the recv() until data was present, or a timeout
> ocurred, or
> an error ocurred.
> 
> Have I created a non-blocking socket?  I don't know.  In a separate
> procedure,
> I created a socket using:
> 
> // Create a socket                                        
> socketID = socket( cAF_INET: cSOCK_STREAM: cIPPROTO_IP ); 
> 
> And I'm setting the socket options as follows:
> 
> // Set socket address attributes
> sin_family = cAF_INET;          
> sin_addr = IP;         // IP address determined earlier in this proc
> sin_port = sPort;      // Port number determined earlier in this proc
> sin_zero = *ALLx'00'; 
> 
> And I'm connecting as follows:
> // Connect to the host                                    
> if connect( socketID: pMySockAddr: addrLen ) < 0;         
> 
>  <do stuff if failure>
>                         
> endif;  
> 
> Does this create a blocking socket?
> 
> As I say, steps 1, 2, 3 of the above scenario work just file. On the
> Visual
> Basic side, I've tried two TCP/IP OCX controls to do comms:  the standard
> MS
> Winsock control (Visual Studio 6, Service Pack 2), and Catalyst's
> SocketWrench
> (SP 5).  Both yield the same results.  They both show that the single
> x'00'
> acknowldegement value IS sent to the 400 with no errors.
> 
> I used Ethereal to trap the traffic between the PC and the AS/400, and
> the data
> goes to the PC correctly.  More importantly, I can see the
> acknowldegement is
> in the traffic going to the 400.  I used the 400 comms trace, and I can
> see
> that the 400 receives the acknowldegement data.
> 
> I know I'm missing something stupid here.
> 
> Anyone have any ideas?  (I'm sorry if I haven't included enough code; I'm
> trying to avoid posting great hunks of my program.)
> 
> Thanks
> 
> -Doc
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
> list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
> 
-- 
  
  michaelr_41@xxxxxxxxxxxxxx

-- 
http://www.fastmail.fm - Sent 0.000002 seconds ago

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.