comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Characters stream through Network Sockets (C <=> Ada)
Date: Wed, 28 Dec 2011 17:52:13 +0200
Date: 2011-12-28T17:52:13+02:00	[thread overview]
Message-ID: <9m0s9dF90hU1@mid.individual.net> (raw)
In-Reply-To: <0ca20824-422d-4384-8486-67301c35e5c6@u32g2000yqe.googlegroups.com>

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
       .      @       .



      reply	other threads:[~2011-12-28 15:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-28 13:32 Characters stream through Network Sockets (C <=> Ada) Ada BRL
2011-12-28 15:52 ` Niklas Holsti [this message]
replies disabled

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