comp.lang.ada
 help / color / mirror / Atom feed
* Trouble getting Winsock binding to work.
@ 2000-02-16  0:00 Marin D. Condic
  2000-02-16  0:00 ` Pascal Obry
  2000-02-16  0:00 ` Vladimir Olensky
  0 siblings, 2 replies; 9+ messages in thread
From: Marin D. Condic @ 2000-02-16  0:00 UTC (permalink / 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. 
=============================================================




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

end of thread, other threads:[~2000-02-17  0:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-16  0:00 Trouble getting Winsock binding to work Marin D. Condic
2000-02-16  0:00 ` Pascal Obry
2000-02-16  0:00   ` Marin D. Condic
2000-02-17  0:00     ` Gisle S�lensminde
2000-02-17  0:00       ` Pascal Obry
2000-02-17  0:00     ` Vladimir Olensky
2000-02-17  0:00     ` Pascal Obry
2000-02-16  0:00 ` Vladimir Olensky
2000-02-16  0:00   ` Marin D. Condic

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