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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7df2baf73b28aa5d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-04 19:27:20 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!news-out.superfeed.net!propagator2-maxim!news-in-maxim.spamkiller.net!news.usc.edu!attla2!ip.att.net!attbi_feed3!attbi_feed4!attbi.com!attbi_s53.POSTED!not-for-mail From: "Steve" Newsgroups: comp.lang.ada References: <56a4b188.0311040645.64f825f7@posting.google.com> Subject: Re: socket, pipe X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: NNTP-Posting-Host: 12.211.58.135 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s53 1068002838 12.211.58.135 (Wed, 05 Nov 2003 03:27:18 GMT) NNTP-Posting-Date: Wed, 05 Nov 2003 03:27:18 GMT Organization: Comcast Online Date: Wed, 05 Nov 2003 03:27:18 GMT Xref: archiver1.google.com comp.lang.ada:2064 Date: 2003-11-05T03:27:18+00:00 List-Id: 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" 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