comp.lang.ada
 help / color / mirror / Atom feed
* GNAT.Sockets
@ 2002-02-23 12:20 Alexei Polkhanov
  2002-02-25 18:11 ` GNAT.Sockets Pascal Obry
  2002-03-23 23:53 ` GNAT.Sockets Volkert
  0 siblings, 2 replies; 9+ messages in thread
From: Alexei Polkhanov @ 2002-02-23 12:20 UTC (permalink / raw)


Hello.
    Does GNAT.Sockets from Gnat-3.14 works on Win2000 ?
    Somehow I manage to get some visible (by sniffer) activity on stack
running my own code.
Example taken from g-sockets.ads works fine on all UNIX platforms I have
tried, but
again on Win2000 it does not, raising  "GNAT.SOCKETS.SOCKET_ERROR: [0] No
error" or "GNAT.SOCKETS.HOST_ERROR: Unknown error"
I suspect NT version little bit broken (?)
What about other GNAT.* packages ? Are they work on NT ? 2000 ? XP ?
Of course I can use Win32 bindings from GNAT, but then again it is platform
specific. In that case I better write low level socket stuff in C and bind
Ada code to it. What is GNAT.* for ?

Code I tried (below) gives me: STORAGE_ERROR: EXCEPTION_STACK_OVERFLOW.

with GNAT.Sockets; use GNAT.Sockets;
with Ada.Text_IO;
with Ada.Exceptions; use Ada.Exceptions;
procedure Main is
    Address  : Sock_Addr_Type;
    Socket   : Socket_Type;
    Channel  : Stream_Access;
begin
    Initialize (Process_Blocking_IO => False);
    Address.Addr := Addresses (Get_Host_By_Name("mail.ica.net"), 1);
    Address.Port := 25;
    Create_Socket (Socket);
    Connect_Socket (Socket, Address);
    Channel := Stream (Socket);
    Ada.Text_IO.Put_Line (String'Input (Channel));
    Close_Socket(Socket);
    Finalize;

    exception when E : others =>
        Ada.Text_IO.Put_Line
             (Exception_Name (E) & ": " & Exception_Message (E));
end Main;






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

* Re: GNAT.Sockets
  2002-02-23 12:20 GNAT.Sockets Alexei Polkhanov
@ 2002-02-25 18:11 ` Pascal Obry
  2002-03-23 23:53 ` GNAT.Sockets Volkert
  1 sibling, 0 replies; 9+ messages in thread
From: Pascal Obry @ 2002-02-25 18:11 UTC (permalink / raw)



"Alexei Polkhanov" <alexp@ica.net> writes:

> Hello.
>     Does GNAT.Sockets from Gnat-3.14 works on Win2000 ?

Yes.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--|
--| "The best way to travel is by means of imagination"



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

* Re: GNAT.Sockets
  2002-02-23 12:20 GNAT.Sockets Alexei Polkhanov
  2002-02-25 18:11 ` GNAT.Sockets Pascal Obry
@ 2002-03-23 23:53 ` Volkert
  2002-03-24  7:22   ` GNAT.Sockets Pascal Obry
  2002-03-24  8:56   ` GNAT.Sockets Volkert
  1 sibling, 2 replies; 9+ messages in thread
From: Volkert @ 2002-03-23 23:53 UTC (permalink / raw)


"Alexei Polkhanov" <alexp@ica.net> wrote in message news:<2OLd8.106741$Cg5.6627950@news1.calgary.shaw.ca>...
> Hello.
>     Does GNAT.Sockets from Gnat-3.14 works on Win2000 ?
>     Somehow I manage to get some visible (by sniffer) activity on stack
> running my own code.
> Example taken from g-sockets.ads works fine on all UNIX platforms I have
> tried, but
> again on Win2000 it does not, raising  "GNAT.SOCKETS.SOCKET_ERROR: [0] No
> error" or "GNAT.SOCKETS.HOST_ERROR: Unknown error"
I have the same behaviour on my Win2000 box!

Volkert



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

* Re: GNAT.Sockets
  2002-03-23 23:53 ` GNAT.Sockets Volkert
@ 2002-03-24  7:22   ` Pascal Obry
  2002-03-24  8:56   ` GNAT.Sockets Volkert
  1 sibling, 0 replies; 9+ messages in thread
From: Pascal Obry @ 2002-03-24  7:22 UTC (permalink / raw)



volkert.barr@freenet.de (Volkert) writes:

> "Alexei Polkhanov" <alexp@ica.net> wrote in message news:<2OLd8.106741$Cg5.6627950@news1.calgary.shaw.ca>...
> > Hello.
> >     Does GNAT.Sockets from Gnat-3.14 works on Win2000 ?

Yes.

> >     Somehow I manage to get some visible (by sniffer) activity on stack
> > running my own code.
> > Example taken from g-sockets.ads works fine on all UNIX platforms I have
> > tried, but
> > again on Win2000 it does not, raising  "GNAT.SOCKETS.SOCKET_ERROR: [0] No
> > error" or "GNAT.SOCKETS.HOST_ERROR: Unknown error"
> I have the same behaviour on my Win2000 box!

Have you properly initialized the GNAT.Sockets package ?

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--|
--| "The best way to travel is by means of imagination"



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

* Re: GNAT.Sockets
  2002-03-23 23:53 ` GNAT.Sockets Volkert
  2002-03-24  7:22   ` GNAT.Sockets Pascal Obry
@ 2002-03-24  8:56   ` Volkert
  1 sibling, 0 replies; 9+ messages in thread
From: Volkert @ 2002-03-24  8:56 UTC (permalink / raw)


volkert.barr@freenet.de (Volkert) wrote in message news:<39ee2480.0203231553.5d6b234d@posting.google.com>...
> "Alexei Polkhanov" <alexp@ica.net> wrote in message news:<2OLd8.106741$Cg5.6627950@news1.calgary.shaw.ca>...
> > Hello.
> >     Does GNAT.Sockets from Gnat-3.14 works on Win2000 ?
> >     Somehow I manage to get some visible (by sniffer) activity on stack
> > running my own code.
> > Example taken from g-sockets.ads works fine on all UNIX platforms I have
> > tried, but
> > again on Win2000 it does not, raising  "GNAT.SOCKETS.SOCKET_ERROR: [0] No
> > error" or "GNAT.SOCKETS.HOST_ERROR: Unknown error"
> I have the same behaviour on my Win2000 box!
Doh! Sorry, my fault! All works fine now ;-) 

Volkert



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

* GNAT.Sockets
@ 2007-10-09 13:04 Bartek
  2007-10-09 15:10 ` GNAT.Sockets anon
  0 siblings, 1 reply; 9+ messages in thread
From: Bartek @ 2007-10-09 13:04 UTC (permalink / raw)


Hi,

I'm trying to establish an Inter Process Communication using Sockets.
The connection is stable, and I can allready send Strings out oy my Ada 
app. But the Problem I have, is to read data out of the stream.

I'm still not sure, if the Ada.Streams.Read function is usefull for my 
problem!?

Thanks for Advices.

BP



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

* Re: GNAT.Sockets
  2007-10-09 13:04 GNAT.Sockets Bartek
@ 2007-10-09 15:10 ` anon
  2007-10-09 20:36   ` GNAT.Sockets Maciej Sobczak
  0 siblings, 1 reply; 9+ messages in thread
From: anon @ 2007-10-09 15:10 UTC (permalink / raw)


Last year I created a progran connects an Ada server class program to 
a TENET program. It uses string in Ada, but bypasses the direct usage 
of Ada.Streams.  So:

-- For sending data strings use either 

         String'Output ( Channel, Message ) ;
-- or
         String'Write ( Channel, Message ) ;

-- to receive a data string:

         -- Get message length 

         Integer'Read ( Channel, Length_Message ) ;

         -- Get String with length => Length_Message

         String'Read ( Channel, Message ( 1 .. Length_Message ) ) ;




In <fefu9e$heu$1@news1.ewetel.de>, Bartek <bartek@tzi.de> writes:
>Hi,
>
>I'm trying to establish an Inter Process Communication using Sockets.
>The connection is stable, and I can allready send Strings out oy my Ada 
>app. But the Problem I have, is to read data out of the stream.
>
>I'm still not sure, if the Ada.Streams.Read function is usefull for my 
>problem!?
>
>Thanks for Advices.
>
>BP




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

* Re: GNAT.Sockets
  2007-10-09 15:10 ` GNAT.Sockets anon
@ 2007-10-09 20:36   ` Maciej Sobczak
  2007-10-10  4:52     ` GNAT.Sockets Simon Wright
  0 siblings, 1 reply; 9+ messages in thread
From: Maciej Sobczak @ 2007-10-09 20:36 UTC (permalink / raw)


On 9 Pa , 17:10, a...@anon.org (anon) wrote:

>          -- Get message length
>
>          Integer'Read ( Channel, Length_Message ) ;

How does it deal with endianness issues?
Or in general with different representation on two communicating
platforms?

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com




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

* Re: GNAT.Sockets
  2007-10-09 20:36   ` GNAT.Sockets Maciej Sobczak
@ 2007-10-10  4:52     ` Simon Wright
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Wright @ 2007-10-10  4:52 UTC (permalink / raw)


Maciej Sobczak <see.my.homepage@gmail.com> writes:

> On 9 Pa , 17:10, a...@anon.org (anon) wrote:
>
>>          -- Get message length
>>
>>          Integer'Read ( Channel, Length_Message ) ;
>
> How does it deal with endianness issues?
> Or in general with different representation on two communicating
> platforms?

AdaCore supply an alternate body for System.Stream_Attributes
(s-stratt.adb) in s-strxdr.adb. This converts to/from XDR
representation on the fly.

One way to deal with this is to copy s-strxdr.adb to s-stratt.adb in
your source path and use gnatmake -a.

Another is to rebuild the RTS (there's a makefile in adalib or
adainclude, forget which) and use the --RTS= switch (I think in GPR
package Builder).

As a matter of interest, we found that the PowerPC (G4)'s native
representation is the same as XDR except for Wide_Character, which is
2 bytes natively and 4 via s-strxdr.adb. That's 3.16a1, not sure about
the latest releases. We don't use Wide_Character, so we can use the
native RTS on VxWorks/PPC and XDR on the host (intel) side; the XDR
conversions for floats look complex & possibly loady, not measured,
but more important is reducing the need to modify third-party tools
and code.



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

end of thread, other threads:[~2007-10-10  4:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-09 13:04 GNAT.Sockets Bartek
2007-10-09 15:10 ` GNAT.Sockets anon
2007-10-09 20:36   ` GNAT.Sockets Maciej Sobczak
2007-10-10  4:52     ` GNAT.Sockets Simon Wright
  -- strict thread matches above, loose matches on Subject: below --
2002-02-23 12:20 GNAT.Sockets Alexei Polkhanov
2002-02-25 18:11 ` GNAT.Sockets Pascal Obry
2002-03-23 23:53 ` GNAT.Sockets Volkert
2002-03-24  7:22   ` GNAT.Sockets Pascal Obry
2002-03-24  8:56   ` GNAT.Sockets Volkert

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