All communications from the client TCP thread and the AMarquee server
arrive at your application's doorstep in the form of QMessages.
In C or Pascal, these QMessages can be accessed by your program
by waiting on the qMsgPort field in the QSession struct that is
returned by QNewSession. In ARexx, you can receive QMessages
by calling GetNextQMessage.
Every QMessage you receive should eventually be freed by your
application, via the FreeQMessage call. You must
use this call, and not FreeMem() or ReplyMsg(), when you are done with
QMessages. Any data you wish to keep from the QMessage you must have
been copied out into your own storage area(s) before you free the QMessage.
The QMessage has many fields, all of which bear explanation.
Note that ARexx scripts cannot read these fields directly; instead,
they should use the GetQMessageField function to access them.
Here they are:
- struct Message qm_Msg;
Used for normal Amiga messaging stuff. You shouldn't need to
access the data within this struct directly.
- LONG qm_ID;
Contains the ID number of a transaction you sent, that this message
is in response to. ID numbers for each transaction are returned by
the Q*Op() calls, and let you determine which QMessages resulted from
which calls. Valid ID numbers are monotonically increasing, starting
at 1. You may see qm_ID's of 0, if the message is not associated with
any particular transaction (such as when the message was caused by a
QMessageOp or a QSendRawOp or
executed by another client or raw socket data), or of -1 for certain types of
error.
- int qm_Status;
Contains the error status of the message. For normal operation
results, this will be set to QERROR_NO_ERROR, but if there was
an error, it may be one of the following:
QERROR_UNKNOWN
Something has gone wrong, but nobody knows what! You should
actually never see this.
QERROR_MALFORMED_KEY
You specified a node path that was syntactically incorrect,
or is impossible (such as specifying a node in a directory that
doesn't exist)
QERROR_NO_SERVER_MEM
The AMarquee server ran out of memory and thus was not able
to perform the operation. This is a serious error, and if
you get it you should not count on any subsequent transactions
in the same message packet having been performed!
QERROR_NO_CONNECTION
The TCP connection to the AMarquee server has been severed. Once
you get this, the only thing you can really do is QFreeSession
your session and start a new one--there is no way to reconnect
a disconnected session.
QERROR_UNPRIVILEGED
You tried to do something you're not allowed to do (such as
writing to another client's directory or renaming your root node).
Note that trying to read from the directory of a client who has
excluded you via QSetAccessOp will not result in this error--
rather, you just won't get any results back. You will also get
this error code if you sent a QMessageOp that no other clients
were willing to receive.
QERROR_UNIMPLEMENTED
You tried to use a feature that I haven't implemented yet.
You may get this error if you are receiving data in a direct
client-to-client connection and the sending client sends you
a transaction that does not make sense in this context.
(for example, a QSetAccessOp)
QERROR_NO_CLIENT_MEM
Your computer ran out of memory, and thus could not perform
the operation.
QERROR_SYS_MESSAGE
This message is a system message sent to you by a client
with QPRIV_SENDSYSMESSAGES access. The qm_Path field will tell
you who sent it to you, and the qm_Data field is a NULL-terminated
ASCII string that contains the text of the message.
Note that you will only ever see this value of qm_Status if
you have requested QPRIV_GETSYSMESSAGES access.
QERROR_SEND_DONE
This message was sent to you by the AMarquee TCP thread running
on your machine, to let you know that your QGo() packet has
been sent (or at least, that it has been completely handed off
to the TCP Stack's transmission code). You will only get this QMessage
back if you specified the QGOF_NOTIFY flag in your call to QGo().
The qm_ID field of this QMessage is the same as the return value
of the QGo() call that caused it to be sent. (This status
type is new for v47 of amarquee.library)
- char * qm_Path;
If the QMessage is returning information about a particular node,
this will point to a NULL-terminated, fully qualified path string
identifying the node. As returned by the AMarqueed server, this
string will never have wildcards in it, and will always be
"absolute" (with the computer and program name explicitely
specified). If no node is being referenced (as in, for example,
error or ping messages), this entry will be NULL.
If you are using the raw socket functions QNewSocketSession(),
QNewSocketSessionAsync(), QNewSocketServerSession() then it will contain
the domain name of the remote host and the local tcp port it is
connected to. E.g. localhost:1027
- void * qm_Data;
If a data buffer is being returned with the QMessage, this will
point to the first byte of the buffer (otherwise it will be NULL).
The data buffer belongs to the TCP thread, and will be freed when
the QMessage is freed. You are allowed to read from or write to
this buffer until you call FreeQMessage on this QMessage.
- ULONG qm_DataLen;
Contains the number of bytes in the qm_Data buffer that is
included with this QMessage.
- ULONG qm_ActualLen;
Contains the size of the data buffer associated with this node,
as it is stored on the server. This value is usually equal to
qm_DataLen, but it may be larger than qm_DataLen if you told
QGetOp or QSubscribeOp to limit the size of data buffers you
receive (via the maxBytes argument).
- ULONG qm_ErrorLine;
If qm_Status is not QERROR_NO_ERROR, this entry will contain the line
number of the command in the AMarqueed source code that triggered
the error. This is to help me in debugging the AMarquee server.
- void * qm_Private;
Points to secret magic stuff used by the TCP thread. Leave
this alone!
- struct QSession * qm_Session; (AMarquee V51)
The QSession associated with the QMessage.
You need to use this if you use shared message ports.
Converted on 24 Mar 2002 with RexxDoesAmigaGuide2HTML 2.1e(private) by Michael Ranner.