-----BEGIN PGP SIGNED MESSAGE-----
I dont know about Win but on Unix converting the length through htons()
works.
Cheers
Paul
- -----------------------------------
Dont worry Marge.
Trying is the first step to failure
-- Homer J. Simpson
On Fri, 29 Dec 2000, Paul Rony wrote:
> 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
> > >
>
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv
Comment: Public key ID: 0xD467B527
iQEVAwUBOkzsSlj6i6zUZ7UnAQEYHAf/YrDo3Mv1xV8AMs6STNV5vn2Hp2VKpVrS
q+pPLxZi5S52uzvBs2SOBy9LAeSMfQd15mMYYwMEj/IOrxGuRWtZAuPYIvJQyPw9
JxvJOvTr1MWgsOV6oAtAy95N+SDgwaje4SKtKWQG9nx9t9NdYNFxId2y+iYU+6oS
EWKMnKtQmSB4G94/fnF6icfdt5AT0u4Lo5S4rKLSaQodTELWjJj3N0ORZtQ1mNX+
RJw4M0q8cb9f90RPD6g2yN6Ik3uVb5eg7azl57JNu3OuSBhj/sewsmEHjzW/sWpY
A+8NHTPco9LxGr4UJKI8eLt6jg1rK3tRJW54cnpQeTd5BwMIjTVYLg==
=4syM
-----END PGP SIGNATURE-----