TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Proportional Font
Show HTML Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
X-To:
Date:
Wed, 5 Aug 1998 10:28:56 -0400
Reply-To:
Subject:
From:
"Robert L. Spooner" <[log in to unmask]>
Content-Transfer-Encoding:
7bit
Content-Type:
text/plain; charset=us-ascii
Organization:
Applied Research Laboratory
MIME-Version:
1.0
Parts/Attachments:
text/plain (48 lines)
Thomas,

I would say that, strictly speaking, they are not needed.  However,
without them you may have to duplicate in your program facilities that are
already available in your execution environment.  Let's say you want to
send multiple messages, but also do other things at the same time.  With a
blocking or synchronous send, you would need a queue (either implemented
as a protected type or having a task) to accept messages, and a task to
remove messages from the queue and send them.  With a nonblocking socket,
you could issue a send and go off to do other things, letting the
operating system buffer the messages.  I'm not familiar with sockets in
the Windows environment, but if you need a timeout for the I/O so that you
get an error if the specified operation does not occur within a given
amount of time, for UNIX, VAXELN or VxWorks a call to select can be used
and under VMS an AST entry can be employed in a select statement with a
delay alternative.  You save at least one task or protected type by having
nonblocking sockets and possibly more, depending on what you are doing and
what it takes to clean up if something goes wrong.

It can be argued that using Ada rather than operating system specific
features is a more general and portable approach.  However, not all Ada
compilers implement tasking in exactly the same way, and  at some level
(presumably well hidden from the application) operating system specific
code is required.  Thus complete generality is impossible and the question
becomes "Where is the optimum level for the boundary between general and
operating system specific code?"  In general (with, in my experience, one
notable exception which is no longer relevant) TCP/IP protocol stacks have
been tested much more extensively than your code will be, and are highly
reliable.  Therefore, in my opinion, it is advisable to use the available
facilities for asynchronous I/O rather than writing your own.

Thomas W Moran wrote:

> Are non-blocking sockets really needed, given Ada's tasking abilities?

Regards,
Bob
--
                               Robert L. Spooner
                         Registered Professional Engineer
                               Research Assistant
                         Intelligent Control Systems Group

            Applied Research Laboratory        Phone: (814) 863-4120
            The Pennsylvania State University  FAX:   (814) 863-7843
            P. O. Box 30
            State College, PA 16804-0030       [log in to unmask]

ATOM RSS1 RSS2