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



One should  call  WSAStartup before making any
attempt to use sockets under Win32.

Regards,
Vladimir Olensky

Marin D. Condic wrote in message
<38AAE07D.8643B1E3@quadruscorp.aunti.spam.com>...
>Maybe someone here can help me spot the error....

>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

* 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

* Re: Trouble getting Winsock binding to work.
  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-16  0:00 ` Vladimir Olensky
  1 sibling, 1 reply; 9+ messages in thread
From: Pascal Obry @ 2000-02-16  0:00 UTC (permalink / raw)


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


Marin D. Condic a �crit dans le message
<38AAE07D.8643B1E3@quadruscorp.aunti.spam.com>...
>Maybe someone here can help me spot the error....


<<socket problem description removed>>


Why not use the ready to use Ada Socket packages available for UNIX
and NT ?

http://perso.wanadoo.fr/pascal.obry/archive/sockets.tar.gz

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: Trouble getting Winsock binding to work.
  2000-02-16  0:00 ` Vladimir Olensky
@ 2000-02-16  0:00   ` Marin D. Condic
  0 siblings, 0 replies; 9+ messages in thread
From: Marin D. Condic @ 2000-02-16  0:00 UTC (permalink / raw)


Vladimir Olensky wrote:
> 
> One should  call  WSAStartup before making any
> attempt to use sockets under Win32.
> 
Thanks. Thats got to be it. I'll give it a shot...

MDC
-- 
=============================================================
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

* Re: Trouble getting Winsock binding to work.
  2000-02-16  0:00 ` Pascal Obry
@ 2000-02-16  0:00   ` Marin D. Condic
  2000-02-17  0:00     ` Gisle S�lensminde
                       ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Marin D. Condic @ 2000-02-16  0:00 UTC (permalink / raw)


Pascal Obry wrote:
> Why not use the ready to use Ada Socket packages available for UNIX
> and NT ?
> 
> http://perso.wanadoo.fr/pascal.obry/archive/sockets.tar.gz
> 
The current mission is some version of "Here's the C interface - how do
I do the exact same thing only in Ada?" A thick binding might be very
handy at a little later stage in this learning exercise since I plan on
using it in a real project. Just now, I need to understand how it works
at a low level. There's also the issue of Windows sockets not working
exactly 100% identical to Unix sockets and I may need some of the
Windows specific features.

I'm presuming that the link you are pointing me at is a thick binding to
Sockets? You don't happen to have it in .ZIP format? (I don't have the
tar and gz stuff loaded here and would just as soon not bother with it
if I can use PKZIP). Thanks.

MDC
-- 
=============================================================
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

* Re: Trouble getting Winsock binding to work.
  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
  2 siblings, 1 reply; 9+ messages in thread
From: Gisle S�lensminde @ 2000-02-17  0:00 UTC (permalink / raw)


In article <38AB0E67.4B02D8C2@quadruscorp.com>, Marin D. Condic wrote:
>Pascal Obry wrote:
>> Why not use the ready to use Ada Socket packages available for UNIX
>> and NT ?
>> 
>> http://perso.wanadoo.fr/pascal.obry/archive/sockets.tar.gz
>> 
>The current mission is some version of "Here's the C interface - how do
>I do the exact same thing only in Ada?" A thick binding might be very
>handy at a little later stage in this learning exercise since I plan on
>using it in a real project. Just now, I need to understand how it works
>at a low level. There's also the issue of Windows sockets not working
>exactly 100% identical to Unix sockets and I may need some of the
>Windows specific features.

Jerry van Dijk's port of winsockets does the basic things here, so
you can allways look at the source, which is quite readable. Like 
Vladimir told, you need to do some extra initialization on windows,
so you cannot use the original AdaSockets directly.

http://stad.dsl.nl/~jvandyk/packages.html

--
Gisle S�lensminde ( gisle@ii.uib.no )   

ln -s /dev/null ~/.netscape/cookies




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

* Re: Trouble getting Winsock binding to work.
  2000-02-16  0:00   ` Marin D. Condic
  2000-02-17  0:00     ` Gisle S�lensminde
@ 2000-02-17  0:00     ` Vladimir Olensky
  2000-02-17  0:00     ` Pascal Obry
  2 siblings, 0 replies; 9+ messages in thread
From: Vladimir Olensky @ 2000-02-17  0:00 UTC (permalink / raw)



Marin D. Condic wrote in message <38AB0E67.4B02D8C2@quadruscorp.com>...
>Pascal Obry wrote:
>> Why not use the ready to use Ada Socket packages available for UNIX
>> and NT ?
>>
>> http://perso.wanadoo.fr/pascal.obry/archive/sockets.tar.gz


>I'm presuming that the link you are pointing me at is a thick binding to
>Sockets? You don't happen to have it in .ZIP format? (I don't have the
>tar and gz stuff loaded here and would just as soon not bother with it
>if I can use PKZIP). Thanks.


WinZip7 recognizes not only ZIP format but also TAR and GZ and even
Windows CAB file format.
It could be found  at www.winzip.com
No one is uzing PKZIP under Windows now ( only under DOS).

Regards,
Vladimir Olensky






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

* Re: Trouble getting Winsock binding to work.
  2000-02-17  0:00     ` Gisle S�lensminde
@ 2000-02-17  0:00       ` Pascal Obry
  0 siblings, 0 replies; 9+ messages in thread
From: Pascal Obry @ 2000-02-17  0:00 UTC (permalink / raw)


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


Gisle S�lensminde a �crit dans le message ...
>Jerry van Dijk's port of winsockets does the basic things here, so
>you can allways look at the source, which is quite readable. Like
>Vladimir told, you need to do some extra initialization on windows,
>so you cannot use the original AdaSockets directly.
>
>http://stad.dsl.nl/~jvandyk/packages.html
>


This version has an old interface not 100% conform to the UNIX
sockets binding.

The pointer I have given is a fixed version of Jerry's port to have the very
same interface under Windows and UNIX.

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: Trouble getting Winsock binding to work.
  2000-02-16  0:00   ` Marin D. Condic
  2000-02-17  0:00     ` Gisle S�lensminde
  2000-02-17  0:00     ` Vladimir Olensky
@ 2000-02-17  0:00     ` Pascal Obry
  2 siblings, 0 replies; 9+ messages in thread
From: Pascal Obry @ 2000-02-17  0:00 UTC (permalink / raw)


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


Marin D. Condic a �crit dans le message
>I'm presuming that the link you are pointing me at is a thick binding to
>Sockets? You don't happen to have it in .ZIP format? (I don't have the
>tar and gz stuff loaded here and would just as soon not bother with it
>if I can use PKZIP). Thanks.

There is a thick and thin binding there and sorry I don't have a .zip file
:-(

Just in case you don't know, Winzip can handle .tar.gz files.

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

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