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



Hi Scott,

Thanks for your reply.

The format conversion is doing by RPGLE.

>If there's no way to identify which structure you've received, then you
>need to send some additional over the socket that tells the receiving
>application what it's receiving...

     The program will not be able to know which structure it is
receiving.My problem is, how can I identify which            structure I am
receiving in RPGLE.

>There's no such thing as a "Socket Event" in RPG.  (Unless it's something
>that was created as a part of your application?)  If you tell me what the
>business problem you're trying to solve is, I'll see if I can help you.

     My application in RPGLE sends different messages to a PC and it will
not wait for the response from a PC.          After sometime, the PC will
send the response to AS/400, then the RPGLE pgm should interpret the
message   (which structure it is ?) and process accordingly. So, my problem
is how will the program know the socket is    received response from a PC
and which structure?

I hope you understand.

Thanks & Regards






                                                                                
                 
                    Scott Klement                                               
                 
                    <klemscot@klements.        To:     RPG programming on the 
AS400 / iSeries    
                    com>                       <rpg400-l@xxxxxxxxxxxx>          
                 
                    Sent by:                   cc:                              
                 
                    rpg400-l-bounces@mi        Subject:     Re: Socket 
Programming - Receive     
                    drange.com                                                  
                 
                                                                                
                 
                                                                                
                 
                    03/24/2004 12:52 AM                                         
                 
                    Please respond to                                           
                 
                    RPG programming on                                          
                 
                    the AS400 / iSeries                                         
                 
                                                                                
                 
                                                                                
                 





Hi Lakshmi,


> DbTLogonMsg       DS
> D bMsgCode                       5U 0
> D bMsgLen                           5U 0
> D bChannelId                       5U 0
> D bClientId                            5U 0
[SNIP]

When you post source code, please use a fixed-width font.  The columns of
your data structure are all over the place in this message, and that makes
it difficult to read.

Also, this is a minor issue, but...  The PC stores integers in
little-endian format, whereas the iSeries uses big endian format.  If you
do
it this way, one side or the other will have to convert them.

[SNIP]
> eval      rc = send(sock: %addr(bTLogonMsg):%size(bTLogonMsg):0)
<---
> Sends that particular structure
> eval      rc=recv(sock:%addr(bTLogonMsg):%size(bTLogonMsg):0)
> <--- Receives the same structure

Actually, that recv() call will only receive as much of the bTLogonMsg
structure as will fit in a single IP datagram, it won't receive the entire
structure.  You should use a loop to make sure you receive the entire
structure size.

> Example  2:
> eval      rc = send(sock: %addr(bTLogonMsg):%size(bTLogonMsg):0)
> eval      rc=recv(sock:%addr(buffer):%size(buffer):0)           <---
> Different data structure (May be structure 1, structure 2 etc.)
>
> where the var buffer should be able to receive different types of data
> structure. How can I do that in RPG?

What you're doing should work (aside from the issue I mentioned above).
The next step is to determine which structure you have received.  Is there
an identifier of some sort in the structure that you can use to tell which
structure it is?

Once you know which structure it is you can just copy the data into the
appropriate structure, or base the structure on a pointer to the data that
you've received.

If there's no way to identify which structure you've received, then you
need to send some additional over the socket that tells the receiving
application what it's receiving...


> How can I point the buffer to a different structures and the first 2
fields
> in all the structures are same.

Either make the structure be BASED() and point it at the address of the
buffer, or copy the data from the buffer to the structure with
eval btLogonMsg = %subst(buffer:1:%size(btLogonMsg))

> When ever the socket receives something, trigger the event in rpg.Is
anyone
> have an idea about Socket event?

There's no such thing as a "Socket Event" in RPG.  (Unless it's something
that was created as a part of your application?)  If you tell me what the
business problem you're trying to solve is, I'll see if I can help you.
_______________________________________________
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.




Confidentiality Caution
=======================
Privileged/Confidential Information may be contained in this message. If
you are not the addressee indicated in this message (or responsible for
delivery of the message to such person), you may not copy or deliver this
message to anyone. In such case, you should destroy this message and kindly
notify the sender by reply email. Opinions, conclusions and other
information in this message that is not of an official nature shall be
deemed as neither given nor endorsed by SGX unless indicated by an
authorised representative independent of this message.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.