Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
47 user(s) are online (42 user(s) are browsing Forums)

Members: 0
Guests: 47

more...
Support us!
Recent OS4 Files
OS4Depot.net





Help with ARexx from C to a Blitz host?
Quite a regular
Joined:
2006/11/27 17:23
Posts: 535
Hi everybody,

I'm having trouble with ARexx.

I have "borrowed" the ARexx example code from here:
http://thomas-rapp.homepage.t-online.de/examples/rexx.c

I've also checked against other examples and it seems fine.

All I ever get is "Sending notification..", then "Sending message to port... *correct address here*".. and then "Waiting for Reply..."

It never returns. RX_TEST is a Blitz program which just sits waiting for an AREXX event.

I can send messages to the Blitz program via Rx or SendRexx on Aminet. Both work perfectly.
I can send messages using my program to other programs such as MiamiDx or Scout. They work perfectly.
But trying to send a messagr from my program to the Blitz program, the Blitz program never receives the message so my code hangs waiting for a reply that never arrives (because the Blitz program never received it).

Can anyone help? This has me stumped!

int TestRexxvoid )
{
    
struct RexxMsg *rexx_msg NULL;
    const 
char *end_of_song_text "HELLO";
    
struct MsgPort *msgport NULL;

    
printf"Opening library.n" );

    if ( 
RexxSysBase == NULL )
    {
        
RexxSysBase = (struct RxsLib *)OpenLibrary"rexxsyslib.library"0L );
    }

    
test_reply_port CreateMsgPort();

    
printf"Sending notification to RX_TEST.n");
//return;

    
if ( test_reply_port != NULL )
    {
        
// Create the Msg with a reply port.
        
rexx_msg CreateRexxMsgtest_reply_portNULLNULL );

        if ( 
rexx_msg != NULL )
        {
            
// We have a REXX message port and we're not afraid to use it!
            
rexx_msg->rm_Action RXCOMM RXFF_RESULT;
            
rexx_msg->rm_Args] = CreateArgstring( (char *)end_of_song_textstrlenend_of_song_text ));
//            rexx_msg->rm_Stdin = rexx_msg->rm_Stdout = NULL;

            
if ( FillRexxMsgrexx_msg1) != NULL )
            {
                
Forbid();
                
msgport FindPort"RX_TEST" );
                
Permit();

                if ( 
msgport != NULL )
                {
                    
printf"Sending message to port %p.n", (ULONG)msgport );
                    
PutMsgmsgport, &rexx_msg->rm_Node );
                    
printf"Waiting for reply...n");
                    
WaitPorttest_reply_port );
                    
GetMsgtest_reply_port );
                    
printf"reply received.n");
                    if ( 
rexx_msg != NULL )
                    {
                        if ( 
rexx_msg->rm_Result1 == )
                        {
                            
// With a zero error code, Result 2 is a STRPTR.
                            
if ( rexx_msg->rm_Result2 != NULL )
                            {
                                
DeleteArgstring( (STRPTR)rexx_msg->rm_Result2 );
                            }
                        }
                    }
                }
                else
                {
                    
printf"No target port found.n");
                }

                
ClearRexxMsgrexx_msg);

                if ( 
rexx_msg->rm_Args] != NULL )
                {
                    
DeleteArgstringrexx_msg->rm_Args] );
                }
            }
            
DeleteRexxMsgrexx_msg );
            
rexx_msg NULL;
        }
    }
    else
    {
        
printf"No reply msgport available.n");
    }

    
DeleteMsgPort(test_reply_port);
}

_________________
--
Ian Gledhill
ian.gledhill@btinternit.com (except it should be internEt of course...!)
Check out my company's shop: http://www.mutant-caterpillar.co.uk/shop/ - specialising in Sinclair Spectrums but will be adding Amigas!
   Report Go to top

Re: Help with ARexx from C to a Blitz host?
Home away from home
Joined:
2006/12/4 23:15
Posts: 2142
@Spirantho

Try set the name in the node in the Rexx message. Some programs do check for the "REXX" string there.

from ProAction srces.

/* fake that it's from REXX to work round python bug*/
                
((struct Node*)rmsg)->ln_Name "REXX";



(the python bug refrered is fixed by the way)

_________________
Blender For OS4.x : Blues : Walker Broad
   Report Go to top

Re: Help with ARexx from C to a Blitz host?
Quite a regular
Joined:
2006/11/27 17:23
Posts: 535
You, Sir, are (as they say) "Da Man".

It seems like Blitz Basic has the same problem as Python! If you don't set the node manually, even if you use CreateRexxMsg, Blitz just completely ignores it! How very useful!

It works now :)

_________________
--
Ian Gledhill
ian.gledhill@btinternit.com (except it should be internEt of course...!)
Check out my company's shop: http://www.mutant-caterpillar.co.uk/shop/ - specialising in Sinclair Spectrums but will be adding Amigas!
   Report Go to top

Re: Help with ARexx from C to a Blitz host?
Not too shy to talk
Joined:
2008/1/8 15:28
From Dublin/Glasgow
Posts: 265
@Spirantho

There are a couple of different ways of using ARexx in Blitz, and I remember a long time ago having a similar problem myself. I switched to a different library and the problem went away, so it was probably a bug in that particular library. There are at least 2 ARexx libraries, plus the ARexx include that can be used... Which method are you using?

Another potential issue is that perhaps the Blitz demo isn't issuing a correct acknowledgement reply, or any reply at all. Some other applications might not wait for the response and just leave the reply port open until it arrives, meaning they'll still work with a host that doesn't reply properly/at all, whereas your code sits and waits for the acknowledgement.

I have various Blitz programs that can all use ARexx in both directions. I can probably dig up some example source code if you need it?

_________________
   Report Go to top

Re: Help with ARexx from C to a Blitz host?
Quite a regular
Joined:
2006/11/27 17:23
Posts: 535
It's sorted for now, but thanks!
We're using the built-in commands, not the add-on pack. It was just not receiving it, though - obviously it was checking the AREXX port name for some reason!

_________________
--
Ian Gledhill
ian.gledhill@btinternit.com (except it should be internEt of course...!)
Check out my company's shop: http://www.mutant-caterpillar.co.uk/shop/ - specialising in Sinclair Spectrums but will be adding Amigas!
   Report Go to top





[Advanced Search]


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project