comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: socket, pipe
Date: Wed, 05 Nov 2003 03:27:18 GMT
Date: 2003-11-05T03:27:18+00:00	[thread overview]
Message-ID: <q6_pb.79350$275.225642@attbi_s53> (raw)
In-Reply-To: 56a4b188.0311040645.64f825f7@posting.google.com

In anser to the big questions: Is it possible?  Absolutely.

We have Ada applications running in industrial automation applications with
multiple applications exchanging information using TCP/IP sockets.  In our
system, some applications are written in Ada 95, some are written in
Borland's Delphi, some are written in MS Visual C++, some are written in
EPascal running under VAX ELN on a VAX workstation, we even have some
written in C running under VxWorks on a motorola 68k processor.

There is obviously more than one approach you could take for your
application.  We chose to use TCP/IP sockets for our application since we
are operating in a heterogeneous environment (not all systems are running
windows), and TCP/IP is standard across platforms.

Since you are only dealing with windows you might also choose to use pipes
or DCOM.  I don't have any experience with DCOM, but I know that it stands
for "Distributed Common Object Model" and provides a mechanism for
seamlessly sharing information across networsk.  If you want to look into
using DCOM go to www.adapower.com and look into GNATCOM.

If you choose to use sockets, things will work pretty much the way the
documentation for Unix describes, but you'll need to add a call to
"WSAStartup" before you try any of the other calls or nothing will work.
When your application shuts down there is a similar call (I think its
WSAShutdown).

In our application we use streaming sockets.  With streaming sockets the
underlying protocol handles retransmission and out of order delivery to make
things look nice and simple for our application.  The data just looks like a
stream of bytes.

One gotcha's that caught me is the operation of "send" and "recv".  Since
we're using sockets in "blocking" mode I expected the "recv" function to
wait until all of the characters I asked for showed up.  That is NOT the way
it works.  When you issue a recv call asking for a number of characters, the
recv function may return before all of the characters have been read.  The
recv call returns how many characters were actually read.  You have to keep
calling recv until you get all of the data you're looking for.  The same
principle applies to the "send".

Other than these few stumbling blocks, getting sockets to work was pretty
easy.

I haven't really answered your question about the "best" way to do it, but
hopefully I've helped in describing one way.

Steve
(The Duck)

"ghostie" <eieio@coastalnet.com> wrote in message
news:56a4b188.0311040645.64f825f7@posting.google.com...
> I'm quite the Ada newbie.  I'm really a C++ programmer.  But I've been
> tasked with making a change to an Ada application that we have, and
> would appreciate some help getting started.  Please be patient.
>
> We want our Ada application, while running, to share a lot of binary
> information with a different application, this one written in Matlab.
> Each applicaton will produce output data which will be used by the
> other application. Both applications will run on Win2K PCs, and they
> may or may not be on the same computer.
>
> Is this possible?  What would be the best way to do it?  I've tried
> looking up some information but to be honest, I don't understand the
> difference between pipes and sockets and Overlapped I/O and whatever
> else is available, let alone if it is possible to do these things in
> Ada.  All the information I'm finding is either Unix-oriented, or else
> it assumes a moderate level of knowledge (which I don't have).
> My Ada compiler is DACS 4.7.15d.
>
> TIA





  parent reply	other threads:[~2003-11-05  3:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-04 14:45 socket, pipe ghostie
2003-11-04 15:14 ` Ole-Hjalmar Kristensen
2003-11-04 15:33 ` Marius Amado Alves
2003-11-04 17:45   ` Warren W. Gay VE3WWG
2003-11-04 18:48 ` John Woodruff
2003-11-05  3:27 ` Steve [this message]
2003-11-05  5:24   ` tmoran
2003-11-05  9:44 ` Pascal Obry
2003-11-05 12:31 ` Marin David Condic
2003-11-05 14:50   ` Steve
2003-11-05 15:19   ` Steve
2003-11-05 13:45 ` ghostie
2003-11-05 18:54   ` ghostie
2003-11-05 20:41     ` Robert Spooner
2003-11-05 20:18   ` Martin Dowie
2003-11-05 20:23     ` Martin Dowie
2003-11-05 13:54 ` ghostie
2003-11-05 14:26   ` Marius Amado Alves
2003-11-05 23:55   ` Jacob Sparre Andersen
  -- strict thread matches above, loose matches on Subject: below --
2003-11-05 18:49 Beard, Frank Randolph CIV
2003-11-05 19:43 Beard, Frank Randolph CIV
2003-11-05 21:14 ` tmoran
replies disabled

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