comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: tasksing and TCP sockets
Date: Wed, 01 Feb 2006 21:12:33 +0000
Date: 2006-02-01T21:12:33+00:00	[thread overview]
Message-ID: <m2ek2mbx6m.fsf@grendel.local> (raw)
In-Reply-To: uslr3an2u.fsf@acm.org

Stephen Leake <stephen_leake@acm.org> writes:

> Hmm. I don't know how this maps to Read_Socket commands. I would guess
> that it waits for the number of Stream_Elements in Sensor_Cmd_T to be
> available. But it might wait longer than that, especially if
> Sensor_Cmd_T is unconstrained.

If the type is unconstrained, 'Input will read dope info (whose length
it does know) and then read the number of bytes specified by the dope
info. It uses recv() for TCP, recvfrom() for UDP (well, this is 4.0.0
on Darwin, but as I recall this part is pretty standard).

> You could do a Read_Socket into a Stream_Array, and then do 'Input
> from that. That would make it clearer when the task is suspended.

That doesn't work (for TCP) unless you know how large the object is on
the wire!

On the other hand for UDP messages, you *must* read the whole packet
into a stream array (at least as large as the largest supported
packet) and do 'Input from that, because you really really want to
make only one call to the OS socket interface. Similarly for 'Output.



  reply	other threads:[~2006-02-01 21:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-30 22:12 tasksing and TCP sockets Rolf
2006-01-31  2:40 ` Stephen Leake
2006-01-31  6:59   ` tmoran
2006-01-31 23:03     ` Rolf
2006-02-01  1:26       ` Stephen Leake
2006-02-01  7:39         ` Rolf
2006-02-01 14:52           ` Stephen Leake
2006-02-03 20:33             ` Rolf
2006-02-04 12:48               ` Stephen Leake
2006-02-06  5:02     ` Dave Thompson
2006-01-31 22:52   ` Rolf
2006-02-01  1:23     ` Stephen Leake
2006-02-01 21:12       ` Simon Wright [this message]
2006-01-31  3:02 ` Steve
2006-01-31 10:09 ` Dmitry A. Kazakov
2006-01-31 21:55   ` Simon Wright
2006-02-01  8:54     ` Dmitry A. Kazakov
replies disabled

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