comp.lang.ada
 help / color / mirror / Atom feed
* Sockets and NT
@ 2001-03-06  7:27 Jacques Croizat
  2001-03-06  7:47 ` Sven Nilsson
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Jacques Croizat @ 2001-03-06  7:27 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 599 bytes --]

Hello,
I Want to use socket communication in 
Ada programs.
I had a look into 
http://www.adapower.com and I found 
good materials from 
http://www-inf.enst.fr/ANC/ that work fine 
in a Unix platform.
Now I want to make it work with Windows 
NT. I succeeded in producing an 
executable for NT but the execution fails: I 
cannot create a socket.
Thank you for any help. 

__________________________________________________________
Ce message a �t� post� via la plateforme Web club-Internet.fr
This message has been posted by the Web platform club-Internet.fr

http://forums.club-internet.fr/



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

* Re: Sockets and NT
  2001-03-06  7:27 Sockets and NT Jacques Croizat
@ 2001-03-06  7:47 ` Sven Nilsson
  2001-03-06 14:52 ` Marin David Condic
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Sven Nilsson @ 2001-03-06  7:47 UTC (permalink / raw)


Hi

We're using a socket to send data from an Ada 95 application to a Delphi
test-tool. When we implemented this some years ago we found that the
best way was to implement the socket-specific things in C on the windows
platform and then use standard Ada to C imports. Something like this
(please note the code is part of a larger program, so it might not be
complete):

// init_socket.c -------------------------------------------------
#include <winbase.h>
#include <winadvapi.h>
#include <winnt.h>
#include <windows.h>
#include <Windows32/sockets.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <strings.h>
#include <errno.h>

int create_socket()
{
  int sock;

  sock = socket(AF_INET, SOCK_STREAM, 0);
  return sock;
}

// End C code ------------------------------------------------

-- Ada socket thingy -----------------------------------------
with Ada.Text_IO;

procedure Win_Sock is
   -- Link with compiled init_socket.c
   pragma Linker_Options("init_socket.o");

   -- Import socket library calls.
   function create_socket() return Integer;
   pragma Import(Stdcall, Create_Socket, "create_socket");

   Sock : integer := 0;
begin
   Sock := create_socket();

   Ada.Text_IO.Put_Line("Created socket no "&
                        Integer'image(Sock));
end Win_Sock;

-- End of ADA program ------------------------------

This seems to do the trick for us. Mind you,  WinSock really sucks so it
might not be the best of solutions...

-Sven

Jacques Croizat wrote:
> 
> Hello,
> I Want to use socket communication in
> Ada programs.
> I had a look into
> http://www.adapower.com and I found
> good materials from
> http://www-inf.enst.fr/ANC/ that work fine
> in a Unix platform.
> Now I want to make it work with Windows
> NT. I succeeded in producing an
> executable for NT but the execution fails: I
> cannot create a socket.
> Thank you for any help.
> 
> __________________________________________________________
> Ce message a �t� post� via la plateforme Web club-Internet.fr
> This message has been posted by the Web platform club-Internet.fr
> 
> http://forums.club-internet.fr/



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

* Re: Sockets and NT
  2001-03-06  7:27 Sockets and NT Jacques Croizat
  2001-03-06  7:47 ` Sven Nilsson
@ 2001-03-06 14:52 ` Marin David Condic
  2001-03-07 21:50   ` Robert A Duff
  2001-03-06 14:59 ` Ted Dennison
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Marin David Condic @ 2001-03-06 14:52 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1599 bytes --]

On my web page, I have some sample code that uses sockets under WinNT. Go to
http://www.mcondic.com/ and look for "Ada Programming" and you'll find it. I
don't consider it to be a bulletproof subsystem, but it will at least
illustrate how you get there from Ada.

Note that this is dependent on GNAT - or at least presumes that your Ada
compiler provides the package Win32.Winsock as part of the distribution.
(Also, you'll need the linker directives either as a pragma or at the
command line if you are using GNAT.) If you have that package available you
should be able to make very similar calls to Windows as you would to Unix to
use sockets.

Hope this helps.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/



"Jacques Croizat" <noemail@noemailno.com> wrote in message
news:200136-0051-32781@foorum.com...
> Hello,
> I Want to use socket communication in
> Ada programs.
> I had a look into
> http://www.adapower.com and I found
> good materials from
> http://www-inf.enst.fr/ANC/ that work fine
> in a Unix platform.
> Now I want to make it work with Windows
> NT. I succeeded in producing an
> executable for NT but the execution fails: I
> cannot create a socket.
> Thank you for any help.
>
> __________________________________________________________
> Ce message a �t� post� via la plateforme Web club-Internet.fr
> This message has been posted by the Web platform club-Internet.fr
>
> http://forums.club-internet.fr/





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

* Re: Sockets and NT
  2001-03-06  7:27 Sockets and NT Jacques Croizat
  2001-03-06  7:47 ` Sven Nilsson
  2001-03-06 14:52 ` Marin David Condic
@ 2001-03-06 14:59 ` Ted Dennison
  2001-03-06 20:23 ` Randy Brukardt
  2001-03-09  5:51 ` DuckE
  4 siblings, 0 replies; 10+ messages in thread
From: Ted Dennison @ 2001-03-06 14:59 UTC (permalink / raw)


In article <200136-0051-32781@foorum.com>, Jacques Croizat says...
>I Want to use socket communication in 
>Ada programs.
.
>good materials from 
>http://www-inf.enst.fr/ANC/ that work fine 
>in a Unix platform.
>Now I want to make it work with Windows 
>NT. I succeeded in producing an 

I'm currently playing around with AWS (Ada Web Server) on NT. I uses a WinSock
port of the Unix software you downloaded. I got it from Pascal Obry's website at
http://perso.wanadoo.fr/pascal.obry/archive/sockets.tar.gz . It was written by
someone else, so I don't know if there is a more up to date release anywhere.
However, it seems to work fine with AWS.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



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

* Re: Sockets and NT
  2001-03-06  7:27 Sockets and NT Jacques Croizat
                   ` (2 preceding siblings ...)
  2001-03-06 14:59 ` Ted Dennison
@ 2001-03-06 20:23 ` Randy Brukardt
  2001-03-09  5:51 ` DuckE
  4 siblings, 0 replies; 10+ messages in thread
From: Randy Brukardt @ 2001-03-06 20:23 UTC (permalink / raw)


Jacques Croizat wrote in message <200136-0051-32781@foorum.com>...
>Hello,
>I Want to use socket communication in Ada programs.
>I had a look into
>http://www.adapower.com and I found
>good materials from
>http://www-inf.enst.fr/ANC/ that work fine
>in a Unix platform.
>Now I want to make it work with Windows
>NT. I succeeded in producing an
>executable for NT but the execution fails: I
>cannot create a socket.

I think you need a sockets library with an NT implementation.

Claw includes a sockets library. There is a small but very usable
version of the package in the Claw Introductory version
(www.rrsoftware.com). The Introductory version is a free download, and
can be used as much as you like for non-commercial purposes. The full
version of Claw is available from R.R.Software.

                Randy Brukardt
                R.R. Software, Inc.






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

* Re: Sockets and NT
  2001-03-06 14:52 ` Marin David Condic
@ 2001-03-07 21:50   ` Robert A Duff
  2001-03-07 22:36     ` Marin David Condic
  2001-03-08 11:38     ` John English
  0 siblings, 2 replies; 10+ messages in thread
From: Robert A Duff @ 2001-03-07 21:50 UTC (permalink / raw)


"Marin David Condic" <marin.condic.auntie.spam@pacemicro.com> writes:

> Note that this is dependent on GNAT - or at least presumes that your Ada
> compiler provides the package Win32.Winsock as part of the distribution.

You seem to imply that package Win32.Winsock is included as part of
GNAT.  I don't see it in my GNAT (binary distribution, version 3.13p).
What is this package, and where can I get it?

- Bob



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

* Re: Sockets and NT
  2001-03-07 21:50   ` Robert A Duff
@ 2001-03-07 22:36     ` Marin David Condic
  2001-03-08 11:38     ` John English
  1 sibling, 0 replies; 10+ messages in thread
From: Marin David Condic @ 2001-03-07 22:36 UTC (permalink / raw)


I didn't do anything special to load it. Just installed the binary
distribution of GNAT for NT/PC. Somewhere under there was a bunch of files
that act as a thin binding to the Win32api (Win32Ada, I believe.) I don't
have it in front of me at the moment, but my memory was that it had a
"short" (8x3) filename. If you do a search on the GNAT directory (and
subdirectories) for a file that contains the text "Winsock", I'll bet it
shows up.

As I recall, this Win32Ada thingie was auto-generated from the Win32api
header files by Intermetrics (Or was it Averstar by then?) For a while, you
had to get it as a separate bunch of packages which needed to be put in the
search path. There was also a rumor that you had to have a license from
Microsoft to legally use it - but I had close personal friends (who's names
I forget) that used it without asking permission from Bill Gates and it
worked just fine. :-) Sooner or later this collection of stuff seemed to
have migrated into the GNAT release for Windoze and its just there for the
using...Don't know if Bill is aware of it though.........

You might try pulling down my example code from my web page and seeing if it
compiles. If it does, then you must have the Win32Ada interface lying around
there somewhere.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/

"Robert A Duff" <bobduff@world.std.com> wrote in message
news:wccn1axi6zy.fsf@world.std.com...
> "Marin David Condic" <marin.condic.auntie.spam@pacemicro.com> writes:
> You seem to imply that package Win32.Winsock is included as part of
> GNAT.  I don't see it in my GNAT (binary distribution, version 3.13p).
> What is this package, and where can I get it?
>






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

* Re: Sockets and NT
  2001-03-07 21:50   ` Robert A Duff
  2001-03-07 22:36     ` Marin David Condic
@ 2001-03-08 11:38     ` John English
  1 sibling, 0 replies; 10+ messages in thread
From: John English @ 2001-03-08 11:38 UTC (permalink / raw)


Robert A Duff wrote:
> "Marin David Condic" <marin.condic.auntie.spam@pacemicro.com> writes:
> 
> > Note that this is dependent on GNAT - or at least presumes that your Ada
> > compiler provides the package Win32.Winsock as part of the distribution.
> 
> You seem to imply that package Win32.Winsock is included as part of
> GNAT.  I don't see it in my GNAT (binary distribution, version 3.13p).
> What is this package, and where can I get it?

Look in the Bindings\Win32Ada subdirectory of your installation directory.
The package Win32.Winsock is in the files win32-winsock.ads (spec) and
win32-winsock.adb (body).

-----------------------------------------------------------------
 John English              | mailto:je@brighton.ac.uk
 Senior Lecturer           | http://www.it.bton.ac.uk/staff/je
 Dept. of Computing        | ** NON-PROFIT CD FOR CS STUDENTS **
 University of Brighton    |    -- see http://burks.bton.ac.uk
-----------------------------------------------------------------



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

* Re: Sockets and NT
  2001-03-06  7:27 Sockets and NT Jacques Croizat
                   ` (3 preceding siblings ...)
  2001-03-06 20:23 ` Randy Brukardt
@ 2001-03-09  5:51 ` DuckE
  2001-03-09 15:14   ` Marin David Condic
  4 siblings, 1 reply; 10+ messages in thread
From: DuckE @ 2001-03-09  5:51 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 854 bytes --]

You're probably missing one windows dependent detail.  You must call
WSAStartup before any of the socket functions work.

SteveD

"Jacques Croizat" <noemail@noemailno.com> wrote in message
news:200136-0051-32781@foorum.com...
> Hello,
> I Want to use socket communication in
> Ada programs.
> I had a look into
> http://www.adapower.com and I found
> good materials from
> http://www-inf.enst.fr/ANC/ that work fine
> in a Unix platform.
> Now I want to make it work with Windows
> NT. I succeeded in producing an
> executable for NT but the execution fails: I
> cannot create a socket.
> Thank you for any help.
>
> __________________________________________________________
> Ce message a �t� post� via la plateforme Web club-Internet.fr
> This message has been posted by the Web platform club-Internet.fr
>
> http://forums.club-internet.fr/





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

* Re: Sockets and NT
  2001-03-09  5:51 ` DuckE
@ 2001-03-09 15:14   ` Marin David Condic
  0 siblings, 0 replies; 10+ messages in thread
From: Marin David Condic @ 2001-03-09 15:14 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1461 bytes --]

If you want to see a small example of a completely working sockets program
for Windoze, try my web page. The Ada Programming page is:
http://www.mcondic.com/Ada_Programming.html

You'll find some working WinNT socket code there...

MDC

--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"DuckE" <nospam_steved94@home.com> wrote in message
news:rb_p6.530108$U46.15939074@news1.sttls1.wa.home.com...
> You're probably missing one windows dependent detail.  You must call
> WSAStartup before any of the socket functions work.
>
> SteveD
>
> "Jacques Croizat" <noemail@noemailno.com> wrote in message
> news:200136-0051-32781@foorum.com...
> > Hello,
> > I Want to use socket communication in
> > Ada programs.
> > I had a look into
> > http://www.adapower.com and I found
> > good materials from
> > http://www-inf.enst.fr/ANC/ that work fine
> > in a Unix platform.
> > Now I want to make it work with Windows
> > NT. I succeeded in producing an
> > executable for NT but the execution fails: I
> > cannot create a socket.
> > Thank you for any help.
> >
> > __________________________________________________________
> > Ce message a �t� post� via la plateforme Web club-Internet.fr
> > This message has been posted by the Web platform club-Internet.fr
> >
> > http://forums.club-internet.fr/
>
>





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

end of thread, other threads:[~2001-03-09 15:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-06  7:27 Sockets and NT Jacques Croizat
2001-03-06  7:47 ` Sven Nilsson
2001-03-06 14:52 ` Marin David Condic
2001-03-07 21:50   ` Robert A Duff
2001-03-07 22:36     ` Marin David Condic
2001-03-08 11:38     ` John English
2001-03-06 14:59 ` Ted Dennison
2001-03-06 20:23 ` Randy Brukardt
2001-03-09  5:51 ` DuckE
2001-03-09 15:14   ` Marin David Condic

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