Skip to Content.
Sympa Menu

freetds - Re: money wire format

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT ais.org>
  • To: TDS Development Group <freetds AT franklin.metalab.unc.edu>
  • Cc: "Lowden, James K" <LowdenJK AT bernstein.com>
  • Subject: Re: money wire format
  • Date: Wed, 7 Aug 2002 19:03:43 -0400 (EDT)


On Wed, 7 Aug 2002, Mark J. Lilback wrote:

> At 1:54 PM -0400 8/7/2002, Lowden, James K wrote:
> >Also I recently discovered the function ntohs. I wonder how tds_swap_bytes
> >is different, and how to know which to use when. I see of course they have
> >different semantics, but it seems like their purpose is the same.
>
> ntohs converts to little-endian format if on a little-endian
> platform, and does nothing if on a big-endian platform. The
> assumption is that network traffic is always big-endian.
>
> I'd imagine tds_swap_bytes just swaps, without regard for endian-ness
> of the host.

ntohs() as Mark says swaps big end to host order. swap bytes as freetds
uses it typically swaps little endian to big endian. And although it
would do the opposite if called on a bigendian dataset, I don't believe we
use it in that fashion.

Brian





Archive powered by MHonArc 2.6.24.

Top of Page