From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Questions about socket programming Date: Wed, 24 Dec 2014 18:02:07 +0100 Organization: cbb software GmbH Message-ID: <1vt5kszrayia0$.18j888endc4qm.dlg@40tude.net> References: <%pzmw.361295$Mq4.223465@fx25.iad> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: McwZMXz/TeSqy5+IwQvFxw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:24222 Date: 2014-12-24T18:02:07+01:00 List-Id: 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