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.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1f2bb9a889c13dc8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.190.71 with SMTP id go7mr22535303pbc.8.1325087534441; Wed, 28 Dec 2011 07:52:14 -0800 (PST) Path: lh20ni74181pbb.0!nntp.google.com!news2.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Characters stream through Network Sockets (C <=> Ada) Date: Wed, 28 Dec 2011 17:52:13 +0200 Organization: Tidorum Ltd Message-ID: <9m0s9dF90hU1@mid.individual.net> References: <0ca20824-422d-4384-8486-67301c35e5c6@u32g2000yqe.googlegroups.com> Mime-Version: 1.0 X-Trace: individual.net 9m/SspKS6+H0BNS4DJPVpgHZ/EWP/od+bRB43rotoUE5qvnEBC Cancel-Lock: sha1:r15YaUODVt/SUpdHqxZkV7Xg7dM= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: <0ca20824-422d-4384-8486-67301c35e5c6@u32g2000yqe.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2011-12-28T17:52:13+02:00 List-Id: On 11-12-28 15:32 , Ada BRL wrote: > Hello everyone! > > This is my problem: > I have a C program that sends/receives data to/from an Ada program > through Network sockets (pkg GNAT.Sockets). > > I can send a string from the Ada program to the C program. > > BUT I can't send any string (or array of chars) from the C program to > the Ada one: the only thing that works is sending only one character > at a time. > > I've tried using 'Read and 'Input member functions of several types > (Chars, String, Interfaces.C.char_array, ...) but nothing worked. How does the C program tell the Ada program how long the string is? (And vice versa for the Ada-to-C sending.) > > The funniest thing is that inside the C program the send function > seems to be working, since it returns the correct number of characters > sent. A socket has a buffer, so this just means that the characters have been put in the buffer on the sending side. And perhaps sent to the buffer on the receiving side. > Instead, the Ada program blocks itself on 'Read (or 'Input) function > and freezes. This suggests that the Ada program is looking for a longer string than the C program has sent. See my question above. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .