comp.lang.ada
 help / color / mirror / Atom feed
* Adasockets storage problem
@ 2002-02-16  9:40 Nazgul
  2002-02-16 13:53 ` Marc A. Criley
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nazgul @ 2002-02-16  9:40 UTC (permalink / raw)


Hi,

I'm using the Adasockets library to have network funcionallity in a program.
The problem is, it works fine if the server and the client are both running
in the same architecture, for example i386, but when the server runs in a
HP-UX and the client in i386, the client raises and STORAGE_ERROR when
receiving a string.

I suppose it's something about little endian/big endian and using htons(),
htonl(),... like in C, but I don't know how to fix it.

Thanks.

==============
A.Iradier





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Adasockets storage problem
  2002-02-16  9:40 Adasockets storage problem Nazgul
@ 2002-02-16 13:53 ` Marc A. Criley
  2002-02-17  7:09 ` Simon Wright
  2002-02-18  1:37 ` Stephen Leake
  2 siblings, 0 replies; 4+ messages in thread
From: Marc A. Criley @ 2002-02-16 13:53 UTC (permalink / raw)


Nazgul wrote:
> 
> Hi,
> 
> I'm using the Adasockets library to have network funcionallity in a program.
> The problem is, it works fine if the server and the client are both running
> in the same architecture, for example i386, but when the server runs in a
> HP-UX and the client in i386, the client raises and STORAGE_ERROR when
> receiving a string.
> 
> I suppose it's something about little endian/big endian and using htons(),
> htonl(),... like in C, but I don't know how to fix it.

I take it you're using GNAT on both machines.

What does your code look like that you're using to write the string to
the socket?  And to read it off the socket?

Marc A. Criley
Consultant
Quadrus Corporation
www.quadruscorp.com



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Adasockets storage problem
  2002-02-16  9:40 Adasockets storage problem Nazgul
  2002-02-16 13:53 ` Marc A. Criley
@ 2002-02-17  7:09 ` Simon Wright
  2002-02-18  1:37 ` Stephen Leake
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Wright @ 2002-02-17  7:09 UTC (permalink / raw)


"Nazgul" <darkelf@aim.homelinux.com> writes:

> I'm using the Adasockets library to have network funcionallity in a
> program.  The problem is, it works fine if the server and the client
> are both running in the same architecture, for example i386, but
> when the server runs in a HP-UX and the client in i386, the client
> raises and STORAGE_ERROR when receiving a string.
> 
> I suppose it's something about little endian/big endian and using
> htons(), htonl(),... like in C, but I don't know how to fix it.

It may well be.

We've used the GLADE version of System.Stream_Attributes, now in
glade-3.14p-src/Garlic/s-stratt.adb - you don't need the full GLADE
runtime, just (!) compile this file on its own (with -gnatg) and link
with it, at each end of your connection. You may need -I- to get the
compilation to actually see this file, and there may be other parts of
the RTL that need recompiling (I think they get compiled with inlining
on, -gnatn, so there's a dependency on s-stratt.adb that you weren't
expecting).

I wouldn't be surprised if this use also affected what happens when
you use Ada.Streams.Stream_IO.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Adasockets storage problem
  2002-02-16  9:40 Adasockets storage problem Nazgul
  2002-02-16 13:53 ` Marc A. Criley
  2002-02-17  7:09 ` Simon Wright
@ 2002-02-18  1:37 ` Stephen Leake
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Leake @ 2002-02-18  1:37 UTC (permalink / raw)


"Nazgul" <darkelf@aim.homelinux.com> writes:

> Hi,
> 
> I'm using the Adasockets library to have network funcionallity in a program.
> The problem is, it works fine if the server and the client are both running
> in the same architecture, for example i386, but when the server runs in a
> HP-UX and the client in i386, the client raises and STORAGE_ERROR when
> receiving a string.
> 
> I suppose it's something about little endian/big endian and using htons(),
> htonl(),... like in C, but I don't know how to fix it.

Probably the string length is sent as a multibyte integer. You may
have to override String'Output, and send the length in a canonical
endianness.

SAL has some packages that help do endian conversions; see
SAL.Endianness and SAL.Gen.Word_Order_Convert.*

SAL is available at
http://users.erols.com/leakstan/Stephe/Ada/sal.html

GLADE (the multi-partition product that goes with GNAT) also has an
XDR package, that provides similar functionality (I've never used it).

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-02-18  1:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-16  9:40 Adasockets storage problem Nazgul
2002-02-16 13:53 ` Marc A. Criley
2002-02-17  7:09 ` Simon Wright
2002-02-18  1:37 ` Stephen Leake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox