[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [JDEV] Why XML? Because.



Sedat Kapanoglu wrote:
> As I know in ICQ v2 protocol an online alert (packet sent from server to
> client) is a UDP packet only 10 bytes long (with the advantage of using UINs

A UDP packet with NO DATA is at least 24 bytes, and may be more if IP
options are used (5 words for IP, 2 for UDP). Therefore, a UDP packet with
only 10 bytes of data would have at least 150% overhead.  It would be even
more if you include the PPP or ethernet headers. Given this, there is no
sense in bending over backwards to keep the packet short.

> Think you have a list of four thousand people in your roster then
> measure it :)

Say an XML message is 50 bytes, round up to 100 with TCP/IP header. Thats
120 updates per second on a 28.8 modem with 4x compression (XML compresses
easily). 4000 XML updates would take 33 seconds. If you assume that ICQ
gets only 2x compression, 4000 updates would take 22 seconds. Again, not
worth bending over backwards for.

> What if I'm coding in Delphi? :) (I'm currently coding in Delphi in fact
> ehhee). And are the standard libs suitable for network-kind of parsing?

As mentioned, there are many XML parsers already written.

> >Binary??? Ouch. Directly use structs?? Ouch.
> That worked for ICQ, why won't it work for us? :)

Because ICQ isn't relying on people tinkering with the protocol for it's
development to go forward. Binary protocols force you to program at a much
lower level.

> >What if you change your C/C++ code? Break the protocol???
> 
> No. Allow the protocol itself to tolerate the changes. That's not that much
> hard.

It's far easier to make changes in a textual protocol than a binary
protocol. That's why HTTP, SMTP, POP, etc have all become popular 
protocols. They are easy to develop and extend. With all of these
protocols, you can telnet in and play with the server. With a binary
protocol, I have to write a custom client before I can get to square one,
and I never know if a bug is in the client or the server without a sniffer
and lots of analysis.

-=Dan=-