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.cI'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 TestRexx( void )
{
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", 0 );
//return;
if ( test_reply_port != NULL )
{
// Create the Msg with a reply port.
rexx_msg = CreateRexxMsg( test_reply_port, NULL, NULL );
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[ 0 ] = CreateArgstring( (char *)end_of_song_text, strlen( end_of_song_text ));
// rexx_msg->rm_Stdin = rexx_msg->rm_Stdout = NULL;
if ( FillRexxMsg( rexx_msg, 1, 0 ) != NULL )
{
Forbid();
msgport = FindPort( "RX_TEST" );
Permit();
if ( msgport != NULL )
{
printf( "Sending message to port %p.\n", (ULONG)msgport );
PutMsg( msgport, &rexx_msg->rm_Node );
printf( "Waiting for reply...\n", 0 );
WaitPort( test_reply_port );
GetMsg( test_reply_port );
printf( "reply received.\n", 0 );
if ( rexx_msg != NULL )
{
if ( rexx_msg->rm_Result1 == 0 )
{
// 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", 0 );
}
ClearRexxMsg( rexx_msg, 1 );
if ( rexx_msg->rm_Args[ 0 ] != NULL )
{
DeleteArgstring( rexx_msg->rm_Args[ 0 ] );
}
}
DeleteRexxMsg( rexx_msg );
rexx_msg = NULL;
}
}
else
{
printf( "No reply msgport available.\n", 0 );
}
DeleteMsgPort(test_reply_port);
}