comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Ada Networking (General/Design)
Date: Mon, 13 Aug 2012 19:11:30 +0000 (UTC)
Date: 2012-08-13T19:11:30+00:00	[thread overview]
Message-ID: <k0bjh2$kg$1@speranza.aioe.org> (raw)
In-Reply-To: 1gfytw9o9pem2.1xvhednlaotb3$.dlg@40tude.net

>>> If Ada provided higher level socket library with an integrated support of
>>> protected objects and tasks...
>>   What do you mean?
>
>The most difficult and unavoidable part about socket programming is
>tasking. We need reader and writer tasks or else socket-select-driven
>co-routines. The reader and writer parts have to communicate each other in
>some intricate way because it is two tasks but one protocol state machine,
>or one task and many state machines in the case of socket select. There is
>the issue of blocking socket I/O non-abortable by Ada means. All this

The Claw.Sockets package has a simple Socket_Type with
  procedure Open(Socket     : in out Socket_Type;  -- or Server_Type
                 Domain_Name: in     String;  -- or Network_Address_Type
                 Port       : in     Port_Type;
                 Timeout    : in     Duration := 30.0);
and Text_IO style Get/Put for Strings, Input/Output for streams, etc.
It also has a non-blocking Async_Socket_Type with overridable
When_Connect, When_Readable, etc routines, but I find using blocking
sockets with tasks whose structure encodes the state machine is much
simpler.  All the blocking socket routines allow a timeout parameter,
so they in effect poll for data - or a Please_Quit request.  (The
non-blocking routines are of course also polling, via the Windows message
loop.) There are also ftp, pop3, smtp, http, etc packages built on top.



  parent reply	other threads:[~2012-08-15  2:48 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-12 20:26 Ada Networking (General/Design) Shark8
2012-08-12 23:05 ` Shark8
2012-08-13  0:10 ` sbelmont700
2012-08-13  0:25   ` Shark8
2012-08-13  7:11 ` Dmitry A. Kazakov
2012-08-13 12:33   ` Patrick
2012-08-13 13:11     ` Dmitry A. Kazakov
2012-08-13 13:12     ` Marc C
2012-08-13 13:31       ` Dmitry A. Kazakov
2012-08-13 15:51         ` tmoran
2012-08-13 16:19           ` Dmitry A. Kazakov
2012-08-13 16:30             ` Patrick
2012-08-13 16:53               ` Patrick
2012-08-13 18:18               ` Dmitry A. Kazakov
2012-08-13 20:36               ` anon
2012-08-14  5:40                 ` Patrick
2012-08-13 19:11             ` tmoran [this message]
2012-08-13 20:03               ` Dmitry A. Kazakov
2012-08-13 20:28                 ` tmoran
2012-08-14 10:14                   ` Dmitry A. Kazakov
2012-08-14 17:57                     ` tmoran
2012-08-13 17:54         ` Marc C
2012-08-13 18:28           ` Dmitry A. Kazakov
2012-08-13 18:59             ` Marc C
2012-08-13 19:16               ` Dmitry A. Kazakov
2012-08-14  8:39         ` Maciej Sobczak
replies disabled

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