comp.lang.ada
 help / color / mirror / Atom feed
* Characters stream through Network Sockets (C <=> Ada)
@ 2011-12-28 13:32 Ada BRL
  2011-12-28 15:52 ` Niklas Holsti
  0 siblings, 1 reply; 2+ messages in thread
From: Ada BRL @ 2011-12-28 13:32 UTC (permalink / raw)


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.

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.
Instead, the Ada program blocks itself on 'Read (or 'Input) function
and freezes.

Do anyone know how to read a char stream coming from a C program? (I'm
using Winsock2 legacy library)

Thank you very very much!!!!



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Characters stream through Network Sockets (C <=> Ada)
  2011-12-28 13:32 Characters stream through Network Sockets (C <=> Ada) Ada BRL
@ 2011-12-28 15:52 ` Niklas Holsti
  0 siblings, 0 replies; 2+ messages in thread
From: Niklas Holsti @ 2011-12-28 15:52 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-28 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-28 13:32 Characters stream through Network Sockets (C <=> Ada) Ada BRL
2011-12-28 15:52 ` Niklas Holsti

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