comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin D. Condic" <mcondic-nospam@quadruscorp.aunti.spam.com>
Subject: Trouble getting Winsock binding to work.
Date: 2000/02/16
Date: 2000-02-16T17:39:18+00:00	[thread overview]
Message-ID: <38AAE07D.8643B1E3@quadruscorp.aunti.spam.com> (raw)

Maybe someone here can help me spot the error....

I'm using GNAT 3.12p on Win98 and trying to get the Winsock binding to
work successfully. I've got a simple program here which illustrates the
problem. Just to illustrate, I've got a simple call to the "Socket"
function which parallels examples I've found in "Windows Sockets Network
Programming" by Bob Quinn & Dave Shute. I've successfully got the Ada
version of the call to compile, link and run. The problem is that the
function consistently returns INVALID_SOCKET and I can't figure if I
have something wrong with the parameters or am missing something
obvious.

The code below illusrates the problem. If you can spot my error, I'd
appreciate the help. (BTW: If you reply to this message, please remove
all the anti-spam chaff in my return address.)

MDC


with Ada.Text_IO ;
with Win32.Winsock ;

procedure Test_It is
    --
    pragma Linker_Options ("-lwsock32") ;
    --
    Loc_Socket           : Win32.Winsock.Socket ;
    --
    use type Win32.Winsock.Socket ;
    --
begin
    Ada.Text_IO.Put_Line ("Starting Socket Function") ;
    Loc_Socket := Win32.Winsock.socket_func (
        af         => Win32.Winsock.PF_INET,
        c_type     => Win32.Winsock.SOCK_STREAM,
        protocol   => 0) ;
    --
    if (Loc_Socket = Win32.Winsock.INVALID_SOCKET) then
        Ada.Text_IO.Put_Line ("Invalid Socket Returned.") ;
    else
        Ada.Text_IO.Put_Line ("Valid Socket Returned.") ;
    end if ;
    --
    Ada.Text_IO.Put_Line ("Socket Call Complete.") ;
end Test_It ;

-- 
=============================================================
Marin David Condic   - Quadrus Corporation -   1.800.555.3393
1015-116 Atlantic Boulevard, Atlantic Beach, FL 32233
http://www.quadruscorp.com/
m c o n d i c @ q u a d r u s c o r p . c o m

***PLEASE REMOVE THE "-NOSPAM" AND AUNTI.SPAM***
***        PART OF MY RETURN ADDRESS         ***

Visit my web site at:  http://www.mcondic.com/

"Because that's where they keep the money."
    --  Willie Sutton when asked why he robbed banks. 
=============================================================




             reply	other threads:[~2000-02-16  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-16  0:00 Marin D. Condic [this message]
2000-02-16  0:00 ` Trouble getting Winsock binding to work Vladimir Olensky
2000-02-16  0:00   ` Marin D. Condic
2000-02-16  0:00 ` Pascal Obry
2000-02-16  0:00   ` Marin D. Condic
2000-02-17  0:00     ` Pascal Obry
2000-02-17  0:00     ` Vladimir Olensky
2000-02-17  0:00     ` Gisle S�lensminde
2000-02-17  0:00       ` Pascal Obry
replies disabled

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