Hi,
I'm playing with the exec port list to send some AREXX messages to open Ports.
But I wanted to know if I can be sure that the destination port will accept ARexx messages,
For example, when I send ARexx message to WORKBENCH or OWB.1 port, it works great.
But when I send ARexx message to SFS handler port or AMIDOCK port it freezes my program.
Edit : I use the rexx.c of Thomas Rapp method to send messages
http://thomas-rapp.homepage.t-online.de/examples/rexx.c
Thank , by advance, for your help
Well it looks like you have a hard one there. :-)
Being that ARexx ports are on the public port list along with others there is no certain way to make a distinction as I see it. You could check if the port name has all capitals but that still doesn't confirm it as an ARexx port, just increases the likely hood of it being one.
But, what are you trying to achieve by sending Arexx messages to general ports on the list? And what commmand are you sending? Without knowing what the port is for, it's no wonder programs crashed when receiving an Arexx message! Though made public, they are obviously for some private use and using private message formats. So an unexpected ARexx message will just confuse the programs and so eventually crash.
One way to solve this is to send a standard "do nothing" command (NOP) and wait, lets say maximum of 3 seconds, for a reply. If you don't get reply in that time, it's safe to assume that it wasn't an ARexx port.
There is no common "do nothing" command. In fact it is not even common to send commands to ports. And it is surely not common to reply to a message sent to a port. The port's owner can do all kinds of things with messages sent to it.
Yes, you can tell that it's not an ARexx port if you don't get a reply in a certain time. But at the same run you killed most of the ports you sent messages to. So the information is worth nothing and your users will kill you for your bad software.
Never send a message to a port you aren't supposed to do so.
Thank you all for your replies,
I know, by testing, that it's not safe.
I wanted to do this because I was testing to send ARexx messages to YAM and SimpleMail to build a little tool.
At first, it was just for fun and test,
Next, I wanted to and I have integrated a PortList tab in my other tool SysMon who list all public ports with an option to send an arexx message to a specific port (I have just blocked the availability to send messages to ports that I know who are not working)
For me, it's useful for testing purposes (I admit, not everyday) and if somebody will use this option, he will be warned that it's dangerous to send messages to a port if you don't know that it handles arexx messages.
Ready to be killed :)
But before, thank again for your confirmations.
I dare to disagree :) The Amiga User Interface Style Guide lists the standard (or recommended) ARexx commands and the NOP is one of them: http://bielski.org/os4beta/amiga_user_interface_style_guide/advanced_arexx_commands.html
There is no guarantee that the command has been implemented in the target program but in my opinion it's the safest command to send, if you really need to send an ARexx command. I agree that it's not a good idea to send a message to a port which you know nothing about.