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-Thread: 103376,80ae596d36288e8a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.glorb.com!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Why no socket package in the standard ? Date: Sun, 5 Jun 2011 17:30:30 +0200 Organization: cbb software GmbH Message-ID: References: <87k4d4z6b6.fsf@mid.deneb.enyo.de> <87pqmsa65o.fsf@mid.deneb.enyo.de> <1hx6ys2t3o3f8.18zbene4l81d5$.dlg@40tude.net> <87pqms8h6v.fsf@mid.deneb.enyo.de> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: esA39KVNWObnchT5MpKrww.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: g2news2.google.com comp.lang.ada:20593 Date: 2011-06-05T17:30:30+02:00 List-Id: On Sun, 05 Jun 2011 16:51:36 +0200, Florian Weimer wrote: > * Dmitry A. Kazakov: > >> On Sun, 05 Jun 2011 13:06:59 +0200, Florian Weimer wrote: >> >>> * Randy Brukardt: >>> >>>> But one wonders about the wisdom of requiring a particular OS >>>> interface for Ada -- Ada is supposed to be target-independent. >>>> Perhaps it would be OK to reference a small piece of it. >>> >>> For all its faults, there is no alternative to BSD sockets. >> >> So what? Ada's interface to TCP/IP stack and other network stacks need not >> to be thin. On the contrary it should be as abstract as possible in order >> to remain independent on any OS-specific mess. > > Sorry, I have no idea what you're talking about. What would an API > look like that is more abstract than BSD sockets? You would have a root controlled type with derived instances in particular for TCP/IP (one for listening another for connection): Root_Network_Communication_Type (abstract) | Connection_Oriented_Type (abstract) | TCP_IP_Socket_Type (abstract) | TCP_IP_Client_Type (concrete) > Would it > parametrize aspects such as congestion control and packet > fragmentation? Options will be set using primitive operations rather than that awful stuff characteristic for C bindings, just Set_No_Delay (Connection : in out TCP_IP_Socket_Type); Reset_No_Delay (Connection : in out TCP_IP_Socket_Type); Similarly, idiotic BSD sockets' structures for dealing with names and addresses will be replaced with properly designed Ada types. Where is a problem? A more interesting issue would be integrating asynchronous I/O into Ada tasking, e.g. socket select. I think the implementation should provide a task type with corresponding entries, e.g. task type Network_IO is entry Received ( Connection : out not null access TCP_IP_Socket_Type'Class; Buffer : in out Octet_Array; Last : out Positive); entry Connected ... entry Sent ... entry Closed ... entry Assign_Sockets ... (Will Ada 2012 support "out access"?) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de