Hail,
I'll give you what I have in the doc concernig let's say the first message is for Login, user is cars and password scar.
First thing they ask is to establish a connection with the server, which I believe I have accomplished through Winsock. Once a session is established, I have to send a message to the server in order to log in, if all goes well, it should reply with a message that tells me I'mm looged in.
Ok, they call there message for login as follows: SCHAPI_MSG_LOGIN
In answer to this either we get SCHAPI_MSG_LOGGEDIN or a message error SCHAPI_MSG_ERROR/SCHAPI_ERR_INVALID
First they ask that every message body be preceeded by a message header which is constructed as so:
The length and format of the header is fixed. The length of the body is contained in the header. The content of the body is variable. Headers are fixed at 8 bytes in length.
1 byte -> Flags
1 byte -> Code (see message structure below for code number)
2 bytes-> Length (see message structure below for code number)
4 bytes-> RFU (Reserved for futur use)
and then follows the body (the actual message below)
it also says that body lengths will always be in multiples of four bytes
it also specifies something I don't understand, the integer data fields of the header are in big-endian format (i.e. MSB first)???
When the underlying network and network protocols are packet oriented, it is recommended that the header and body each be sent as a packet. That is, neither header nor body should be broken across packets nor should the two be combined into a single packet ??? (how could that be?)
The server does not operate in packet-synchronous mode. Instead, it reads data in byte stream format. This means that even if a client sends message headers and message bodies as packets, the server may still lose message boundaries. Regardless, it is recommended that client apps send messages headers and message bodies as discrete packets.
Data representation
Data fields in the messages are made up of 3 basic data types: integers, strings and bitmaps.
Integers are either 1,2,4 or 8 bytes long. Can be signed or unsigned. Always stored in big-endian format (MSB)
Strings are variable length sequences of US-ASCII characters. Since all fields are of a fixed size, unused bytes in a string must contain zeros. A string field will always be followed by a one byte field labeled zero. This field should always contain NULL character (0x00)
Sign in / Password -> All US-ASCII codes from 0x20 to 0x7e are legal
SCHAPI_MSG_LOGIN
Code = 14
Support= Required
Direction= Query
Length = 52 bytes
0-7 8 9-16 17 18-51
8 for 1 for 8 for 1 for 34 for
signin zero pwd zero rfu (futur use)
That's all I got
As for the actual code with winsock, I'm far from an expert so any insight on the winsock procedure would be appreciated.
I know this is a lot of blah blah so let me know if there's too much stuff or if I might be missing something
Phailak