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.8 required=5.0 tests=BAYES_00,INVALID_MSGID, SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38d1fe109cd56c87 X-Google-Attributes: gid103376,public From: tmoran@bix.com Subject: Re: GNAT, LINUX, KDE Date: 1999/11/28 Message-ID: #1/1 X-Deja-AN: 554183609 References: <81lkb2$mra3@ftp.kvaerner.com> X-Complaints-To: abuse@pacbell.net X-Trace: typhoon-sf.snfc21.pbi.net 943825997 206.170.2.144 (Sun, 28 Nov 1999 13:53:17 PST) Organization: SBC Internet Services NNTP-Posting-Date: Sun, 28 Nov 1999 13:53:17 PST Newsgroups: comp.lang.ada Date: 1999-11-28T00:00:00+00:00 List-Id: >> If similar communication subsystem would be a part of a standard >>or semi-standard Ada environment it could provide an excellent >>platform for many great things and make Ada more competitive >>in some areas where C++ has better positions. >You're not the only one who think along those lines. > >The reason that I want my own binding, is that I want something that "works >with" Ada, not just something that Ada tolerates. I want the compiler to catch >as many as possible of my mistakes. I think it would be unfortunate if a lot of effort went into multiple, slightly different, incompatible Ada packages. Since CLAW works, and, having written the Sockets packages I think they are quite usable, I naturally propose that others either use them, or at least use their interface. A quick glance is: -- Socket_Type is a stream communication socket. -- It's a Controlled type so it will be automatically Closed -- when it goes out of scope. -- Async_Socket_Type (in Claw.Sockets.Non_Blocking) allows "interrupts" -- on Socket_Types. -- Datagram_Type (in Claw.Sockets.Datagrams) is a datagram communication socket. -- Server_Type is a simple server accepting calls from clients, -- using polling or waiting for client arrival notification. -- Async_Server_Type is a server with a When_Client interrupt, rather -- than polling or waiting, for client arrival notification. -- Socket_Stream_Type is a new Root_Stream_Type for T'Read on sockets. procedure Open(Socket : in out Socket_Type; Domain_Name: in String; Port : in Port_Type; Timeout : in Duration := 30.0); procedure Open(Socket : in out Socket_Type; Address : in Network_Address_Type; Port : in Port_Type; Timeout : in Duration := 30.0); procedure Close(Socket : in out Socket_Type); procedure Get (Socket : in out Socket_Type; Item : out String; Last : out Natural); procedure Get (Socket : in out Socket_Type; Timeout : in Duration; Item : out String; Last : out Natural); procedure Put(Socket : in out Socket_Type; Phrase : in String); procedure Put_Line(Socket : in out Socket_Type; Phrase : in String); similar IO for non-string data, records, Ada.Streams, etc. A Server_Type is similar but its most important routine is: procedure Greet(Server : in out Server_Type; Socket : in out Socket_Type'Class); -- Wait for some client to access Server, then set Socket to -- an open socket connected to that client and return. There's also: type Async_Server_Type is new Server_Type with private; -- Server with When_Client notification of client arrival. -- Does not block, but the routine overiding When_Client is -- called on a new client's arrival. When_Client should -- then do a Greet, presumably in a rendezvous with a worker -- task. function Get_Handle (Socket : in Root_Socket_Type'Class) return Socket_Handles; -- A way to get a Windows handle for a socket if you really -- need to pass it to some other low-level stuff. procedure Get_Socket_From_Handle (Socket : in out Socket_Type; Handle : in Socket_Handles); -- A way to get a Claw socket from an existing Windows socket -- handle. There are of course a bunch of utility routines for finding who you are connected to, looking up names, making or tearing apart IP addresses, etc. CLAW handles the Windows messaging stuff internally. The standard CLAW exceptions like Not_Valid_Error, Not_Found, etc are generated as appropriate. There's also Busy : Exception; -- raised when a second task attempts an operation -- on a socket which is already in the middle of -- an operation from a different task. This -- likely would result in a race condition. I really doubt there would be any copyright problems reusing the spec of Claw.Sockets, since compatibility is obviously in the interest of RR Software.