comp.lang.ada
 help / color / mirror / Atom feed
* GNAT sockets
@ 1998-12-29  0:00 Daniel Fanjul
  1998-12-30  0:00 ` dennison
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Daniel Fanjul @ 1998-12-29  0:00 UTC (permalink / raw)


Hello,

I wrote this code to be compiled with GNAT (for Windows 95):

    #include "windows.h"
    #include "windows32\sockets.h"

    int main () {
        SOCKET s;

        s = socket (AF_INET, SOCK_STREAM, 0);
        printf ("%d", s);
        return 0;
    }

The output was -1.

Can anybody help me?

Thanks.

    Daniel.






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

* Re: GNAT sockets
  1998-12-29  0:00 GNAT sockets Daniel Fanjul
  1998-12-30  0:00 ` dennison
@ 1998-12-30  0:00 ` David Botton
  1998-12-30  0:00 ` Steve Doiel
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Botton @ 1998-12-30  0:00 UTC (permalink / raw)


Take a look at

http://www.botton.com/ada/os

There are some Ada 95 examples of sockets and links to thick bindings
for Win32 and Unix.

David Botton
The Ada Source Code Treasury
http://www.botton.com/ada

Daniel Fanjul wrote:

> Hello,
>
> I wrote this code to be compiled with GNAT (for Windows 95):
>
>     #include "windows.h"
>     #include "windows32\sockets.h"
>
>     int main () {
>         SOCKET s;
>
>         s = socket (AF_INET, SOCK_STREAM, 0);
>         printf ("%d", s);
>         return 0;
>     }
>
> The output was -1.
>
> Can anybody help me?
>
> Thanks.
>
>     Daniel.







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

* Re: GNAT sockets
  1998-12-29  0:00 GNAT sockets Daniel Fanjul
@ 1998-12-30  0:00 ` dennison
  1998-12-30  0:00 ` David Botton
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dennison @ 1998-12-30  0:00 UTC (permalink / raw)


In article <368a76d8.0@dial-in.encomix.es>,
  "Daniel Fanjul" <ib313541@public.ibercaja.es> wrote:
> Hello,
>
> I wrote this code to be compiled with GNAT (for Windows 95):
>
>     #include "windows.h"
>     #include "windows32\sockets.h"
>
>     int main () {
>         SOCKET s;
>
>         s = socket (AF_INET, SOCK_STREAM, 0);
>         printf ("%d", s);
>         return 0;
>     }
>
> The output was -1.
>
> Can anybody help me?

Oddly enough, -1 means you got an error. There should be a code in errno
specifing exactly what error you got. The information I just gave you, along
with the information you will need to decipher the errno value should be in
your win32 documentation, or a good book on sockets.

As an aside, there's a little-known feature of Gnat that allows you to compile
Ada code with it. You really ought to try it out. ;-)

--
T.E.D.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: GNAT sockets
  1998-12-29  0:00 GNAT sockets Daniel Fanjul
  1998-12-30  0:00 ` dennison
  1998-12-30  0:00 ` David Botton
@ 1998-12-30  0:00 ` Steve Doiel
  1998-12-31  0:00 ` robert_dewar
  1999-01-01  0:00 ` Jerry van Dijk
  4 siblings, 0 replies; 6+ messages in thread
From: Steve Doiel @ 1998-12-30  0:00 UTC (permalink / raw)



Daniel Fanjul wrote in message <368a76d8.0@dial-in.encomix.es>...
>Hello,
>
>I wrote this code to be compiled with GNAT (for Windows 95):
>
>    #include "windows.h"
>    #include "windows32\sockets.h"
>
>    int main () {
>        SOCKET s;
>
>        s = socket (AF_INET, SOCK_STREAM, 0);
>        printf ("%d", s);
>        return 0;
>    }
>
>The output was -1.
>
>Can anybody help me?
>
Yes.

You need to call WSAStartup before any of the Win32 socket stuff will work
at all.
You'll have to find this in the Win32 documentation since it is Win32
specific (no such call is required under UNIX).

SteveD







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

* Re: GNAT sockets
  1998-12-29  0:00 GNAT sockets Daniel Fanjul
                   ` (2 preceding siblings ...)
  1998-12-30  0:00 ` Steve Doiel
@ 1998-12-31  0:00 ` robert_dewar
  1999-01-01  0:00 ` Jerry van Dijk
  4 siblings, 0 replies; 6+ messages in thread
From: robert_dewar @ 1998-12-31  0:00 UTC (permalink / raw)


In article <368a76d8.0@dial-in.encomix.es>,
  "Daniel Fanjul" <ib313541@public.ibercaja.es> wrote:
> Hello,
>
> I wrote this code to be compiled with GNAT (for Windows
95):
>
>     #include "windows.h"
>     #include "windows32\sockets.h"
>
>     int main () {
>         SOCKET s;
>
>         s = socket (AF_INET, SOCK_STREAM, 0);
>         printf ("%d", s);
>         return 0;
>     }
>
> The output was -1.


The above program was a C program! Not an Ada 95 program.
GNAT is an Ada 95 compiler, so most certainly you did NOT
compile this using GNAT. The GNAT distribution includes the
GNU C front end for gcc, which provides a standard C
environment, but it has nothing to do with Ada, so your
question is better addressed to a different news group.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: GNAT sockets
  1998-12-29  0:00 GNAT sockets Daniel Fanjul
                   ` (3 preceding siblings ...)
  1998-12-31  0:00 ` robert_dewar
@ 1999-01-01  0:00 ` Jerry van Dijk
  4 siblings, 0 replies; 6+ messages in thread
From: Jerry van Dijk @ 1999-01-01  0:00 UTC (permalink / raw)


: The output was -1.

You might take a look at my sockets package for Win32 on my
homepage.

regards,
Jerry.
-- 
-- Jerry van Dijk  | email: jdijk@acm.org
-- Leiden, Holland | member Team-Ada
-- Ada & Win32: http://stad.dsl.nl/~jvandyk




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

end of thread, other threads:[~1999-01-01  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-12-29  0:00 GNAT sockets Daniel Fanjul
1998-12-30  0:00 ` dennison
1998-12-30  0:00 ` David Botton
1998-12-30  0:00 ` Steve Doiel
1998-12-31  0:00 ` robert_dewar
1999-01-01  0:00 ` Jerry van Dijk

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