comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Questions about socket programming
Date: Wed, 24 Dec 2014 18:02:07 +0100
Date: 2014-12-24T18:02:07+01:00	[thread overview]
Message-ID: <1vt5kszrayia0$.18j888endc4qm.dlg@40tude.net> (raw)
In-Reply-To: %pzmw.361295$Mq4.223465@fx25.iad

On Wed, 24 Dec 2014 05:43:21 -0800, Hubert wrote:

> I want to write a small telnet server as an exercise and also because I 
> need this functionality elsewhere. I seem to remember that I read in 
> this newsgroup somewhere some negative opinions about Gnatsockets, but I 
> can't remember where and what it was about.

I am using GNAT.Sockets extensively, there is no problems so far.

> So I wonder, should I use Gnatsocket or are there any problems? Should I 
> rather interface with C and use the C socket implementation directly? I 
> must admit that I tried this today and didn't get very far, because I 
> got linker errors like these:
> 
> Berkley_Socket_Interface_C.c:47: undefined reference to 
> `_imp__getaddrinfo@16'
> Berkley_Socket_Interface_C.c:48: undefined reference to `gai_strerrorA'
> Berkley_Socket_Interface_C.c:49: undefined reference to `_imp__WSACleanup@0'
> 
> collect2.exe: error: ld returned 1 exit status
> 
> and I am out of ideas there. I tried to add to the C linker the 
> following switches:
> 
> -lwsock32 -lws2_32

Windows sockets are not Berkeley sockets and conversely. Which is one
reason to use GNAT.Sockets instead.

> but without luck. I found contradictory information what the correct 
> library name is for mingw, so I tried both but apparantly both are 
> wrong, or the respective libraries are not delivered with Adacore Libre.

There are WinSock versions 1 and 2. See

   http://en.wikipedia.org/wiki/Winsock

> I should had that I don't have Mingw installed, just what comes with 
> Adacore.

You can implement Telnet server on top of this:

http://www.dmitry-kazakov.de/ada/components.htm#multiple_GNAT.Sockets.Servers

or this:

http://www.dmitry-kazakov.de/ada/components.htm#GNAT.Sockets.Connection_State_Machine

The first handles socket communication for you, the second parses incoming
packets as well.

Merry Christmas,

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  parent reply	other threads:[~2014-12-24 17:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-24 13:43 Questions about socket programming Hubert
2014-12-24 14:22 ` David Botton
2014-12-25  3:59   ` Hubert
2014-12-27  1:21   ` Randy Brukardt
2014-12-27  9:48     ` Dmitry A. Kazakov
2014-12-28  0:44     ` David Botton
2014-12-29 12:52     ` Hubert
2014-12-24 17:02 ` Dmitry A. Kazakov [this message]
2014-12-25  4:02   ` Hubert
2014-12-25  4:14     ` Hubert
2015-01-12 20:33     ` David Thompson
2015-01-13  4:31       ` Hubert
2015-01-13  8:53         ` Dmitry A. Kazakov
2015-01-13 20:31           ` Hubert
2015-01-13 21:17             ` Dmitry A. Kazakov
2015-01-15 13:41 ` Kevin K
replies disabled

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