Skip to content

Message

Joshua Scott edited this page Sep 15, 2015 · 12 revisions

Details

A "message" is an application-specific piece of data that is sent through the Reliable Data packet.

Name Type Byte-Order Description
Operand Count N/A N/A Not currently supported.
OpCode uint16 Host The type of data the message contains. (Application-specific)
Data N/A N/A The actual data.

Some applications that use SOE's protocol have an Operand Count before the OpCode. This is not currently supported.

Implementation: SOEMessage

Fragmentation

If a message is larger than the client's buffer size then the message will be fragmented into fragments that would fill the client's buffer size. This message is then only capable of being sent through a Fragmented Reliable Data packet.

Handling a Message

You can use the method attribute SOEMessageHandler to handle messages specific to the application you are writing/emulating.

Example:

[SOEMessageHandler("LOGIN_REQUEST", 0x01, "CGAPI_527")]
public static void HandleLoginRequest(SOEClient sender, SOEMessage message)
{
    ...
}

Another example of it's usage can be found in the SOEHandlers file found here.

Writing a Message

You can write messages through an SOEWriter instance that has been initialized to write messages.

SOEWriter writer = new SOEWriter(0x02, true);

Calling GetFinalSOEPacket on a writer that is set-up to write messages will try to handle it gracefully, and return a Reliable Data packet. If the message is fragmented however, the method will return null. So, while it's possible to use this as a shortcut, it's not advised unless you are certain that the message size will be less than the client's buffer size.

Sending a Message

You can send messages to a client using the SendMessage method. This will automatically add the message to a Reliable Data or Fragmented Reliable Data packet.

Clone this wiki locally