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 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,963021d014ce398e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-05 23:48:08 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!isdnet!newsfeed1.telenordia.se!algonet!uab.ericsson.se!erinews.ericsson.se!news.emw.ericsson.se!not-for-mail Message-ID: <3AA4962C.DBDE27C1@emw.ericsson.se> From: Sven Nilsson Reply-To: sven.nilsson@emw.ericsson.se Organization: Ericsson Microwave Systems AB X-Mailer: Mozilla 4.75C-EMW [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Sockets and NT References: <200136-0051-32781@foorum.com> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Tue, 06 Mar 2001 08:47:56 +0100 NNTP-Posting-Host: 136.225.182.69 X-Trace: news.emw.ericsson.se 983864876 136.225.182.69 (Tue, 06 Mar 2001 08:47:56 MET) NNTP-Posting-Date: Tue, 06 Mar 2001 08:47:56 MET Xref: supernews.google.com comp.lang.ada:5455 Date: 2001-03-06T08:47:56+01:00 List-Id: Hi We're using a socket to send data from an Ada 95 application to a Delphi test-tool. When we implemented this some years ago we found that the best way was to implement the socket-specific things in C on the windows platform and then use standard Ada to C imports. Something like this (please note the code is part of a larger program, so it might not be complete): // init_socket.c ------------------------------------------------- #include #include #include #include #include #include #include #include #include #include int create_socket() { int sock; sock = socket(AF_INET, SOCK_STREAM, 0); return sock; } // End C code ------------------------------------------------ -- Ada socket thingy ----------------------------------------- with Ada.Text_IO; procedure Win_Sock is -- Link with compiled init_socket.c pragma Linker_Options("init_socket.o"); -- Import socket library calls. function create_socket() return Integer; pragma Import(Stdcall, Create_Socket, "create_socket"); Sock : integer := 0; begin Sock := create_socket(); Ada.Text_IO.Put_Line("Created socket no "& Integer'image(Sock)); end Win_Sock; -- End of ADA program ------------------------------ This seems to do the trick for us. Mind you, WinSock really sucks so it might not be the best of solutions... -Sven Jacques Croizat wrote: > > Hello, > I Want to use socket communication in > Ada programs. > I had a look into > http://www.adapower.com and I found > good materials from > http://www-inf.enst.fr/ANC/ that work fine > in a Unix platform. > Now I want to make it work with Windows > NT. I succeeded in producing an > executable for NT but the execution fails: I > cannot create a socket. > Thank you for any help. > > __________________________________________________________ > Ce message a �t� post� via la plateforme Web club-Internet.fr > This message has been posted by the Web platform club-Internet.fr > > http://forums.club-internet.fr/