I still need more information.  Do I send 16-bits (2 bytes) or 32-bits (4
bytes)? 

Normally, when sending 16-bits on an Windows/Intel box, I was just write
  WORD wLength;
  send ( socket, &wLength, sizeof(wLength) );
The send command would write the low byte first, then the high byte.

Big-endian suggests that I must perform painful math before sending.
  WORD wLength;
  BYTE* pLowByte = (BYTE*) &wLength;
  BYTE* pHighByte = pLowByte + 1;
  send ( socket, pHighByte, 1 ) ;
  send ( socket, pLowByte, 1 ) ;

Did I confuse my big-endian and little-endian or do I really have to go
through this mess.  I would much prefer if Content-Length were the only
mechanism used to specify the length of the data.

-----Original Message-----
From: Charles Daminato
To: Paul Rony; [EMAIL PROTECTED]
Sent: 12/29/00 10:45 AM
Subject: RE: Writing Your Own Client

Now, I'm not a programmer but AFAIK...

You must pass the packet length to the server in big endian format in
the
header of the packet ...

Charles Daminato
Product Manager (ccTLDs)
Tucows Inc. - [EMAIL PROTECTED]

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Paul Rony
> Sent: December 29, 2000 10:18 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Writing Your Own Client
>
>
> I was thinking the same thing until I tried to send the CHECK VERSION
> response without the prepended length.  I get no response.  My socket
just
> times out.
>
> I'm also wondering if there is a required format for the MsgID.  I am
just
> generating a large integer, something like 126225524054375003.
> Here is what
> I'm sending:
>
>
> Content-Length: 604
>
> <?xml version='1.0' encoding="UTF-8" standalone="no" ?>
> <!DOCTYPE OPS_envelope SYSTEM "ops.dtd">
> <OPS_envelope>
> <header>
>       <version>0.9</version>
>       <msg_id>126225524054375003</msg_id>
>       <msg_type>standard</msg_type>   </header>
> <body>
>       <data_block>
>               <dt_assoc>
>                       <item key="protocol">XCP</item>
>                       <item key="action">CHECK</item>
>                       <item key="object">VERSION</item>
>                       <item key="attributes">
>                               <dt_assoc>
>                                       <item key="sender">OpenSRS
> CLIENT</item>
>                                       <item
key="version">XML:0.1</item>
>                                       <item key="state">ready</item>
>                               </dt_assoc>
>                       </item>
>               </dt_assoc>
>       </data_block>
> </body>
> </OPS_envelope>
>
>
> Paul Rony
> Merchantware
>
> -----Original Message-----
> From: Scott Meeuwsen [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 29, 2000 9:39 AM
> To: [EMAIL PROTECTED]
> Cc: Paul Rony
> Subject: RE: Writing Your Own Client
>
>
> Paul,
>
> I am just starting to write my own client so maybe I am not the
> best person
> to answer this, but I will give you my theory.  My best guess is the
the
> "data prepend" thing is no longer current and should have been removed
now
> that the "Content-Lenth" header is used.  I am basing this on simply
> telnetting to port 55000 of horizon.opensrs.net.  In the first
> response from
> the server I see the XML request, the Content-Length, but no binary or
hex
> data prepended to each line.  Someone please correct me if I am wrong.
>
> Scott Meeuwsen
> API Technologies, LLC
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On
> > Behalf Of Paul Rony
> > Sent: Friday, December 29, 2000 3:45 AM
> > To: [EMAIL PROTECTED]
> > Subject: Writing Your Own Client
> >
> >
> > I'm trying to follow the Appendix C in order to write my own client
for
> > Windows NT.  I'm using C++, so I'm in full control of every
> byte sent and
> > received.  My problem is that the documentation does not clearly
> > define all
> > bytes in and out.
> >
> > For example, the Data Exchange section mentions that all data must
be
> > prepended with the length of the string.  Is this length a 16-bit
> > or 32-bit
> > number?  Why is this length needed when the XCP protocol already
> > includes a
> > Content-Length header on the first line?
> >
> > Paul Rony
> > Merchantware
> >

Reply via email to