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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,136c120daac2a1 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!peer-uk.news.demon.net!kibo.news.demon.net!mutlu.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: tasksing and TCP sockets Date: Wed, 01 Feb 2006 21:12:33 +0000 Organization: Pushface Message-ID: References: <1138659171.491931.322480@g49g2000cwa.googlegroups.com> <1138747969.510279.15280@g49g2000cwa.googlegroups.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1138828344 4795 62.49.19.209 (1 Feb 2006 21:12:24 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Wed, 1 Feb 2006 21:12:24 +0000 (UTC) Cancel-Lock: sha1:+4JLbmcETmf2QOqW45aZSy+RTpM= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) Xref: g2news1.google.com comp.lang.ada:2739 Date: 2006-02-01T21:12:33+00:00 List-Id: Stephen Leake 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.