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

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.