comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: tasksing and TCP sockets
Date: Mon, 30 Jan 2006 19:02:12 -0800
Date: 2006-01-30T19:02:12-08:00	[thread overview]
Message-ID: <zfWdnRdsnerCT0PenZ2dnUVZ_tednZ2d@comcast.com> (raw)
In-Reply-To: 1138659171.491931.322480@g49g2000cwa.googlegroups.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2195 bytes --]

"Rolf" <rolf.ebert_nospam_@gmx.net> wrote in message 
news:1138659171.491931.322480@g49g2000cwa.googlegroups.com...
[snip]
>In a stripped down version I can succesfully connect to the server
>(using GNAT.Sockets) and either read the sensor data *or* write actor
>data. The program is currently split in two tasks. One tasks contains
>the application code and the actor communication (using
>type_id'output(channel)). The second tasks gets started during program
>initialisation. It reads the data from the socket via
>type_id'input(channel) and provides the data to the application through
>a protected object.
>
>The problem that I face is that the second task seems to starve the
>first one. As soon as it is active, the application does not generate
>debug output anymore.
>
>Some background info: gcc-3.4.4 on Windows XP. Java for the world
>simulation. The simulator sends about 20 packages � 11bytes every
>100ms. The application sends typically 2-3 packages per second. I have
>delay statements in both main loops (varied between 0.0 and 0.2
>seconds).
>
>My questions:
> - is that a reasonable tasking approach?
> - I don't know much about sockets (or better I don't remember much).
>Does a waiting read (in the second task) block a write in the first
>task?
> - how can I interrupt the waiting read task to force activity in the
>main task?
> - what other hints can you give me?
>
>
>TIA
>   Rolf

Your approach sounds reasonable to me.
I wrote my own wrappers for Win32 sockets API before GNAT.Sockets
was born,  so I can't say much about their behavior... but,  using the
Win32 API, I have been able to have one task reading a socket and another
task writing the same socket using blocking TCP/IP sockets with no
issues of reads causing writes to block or vise-versa.

I have seen the type of problem you describe with serial I/O on windows.
With serial I/O you have to open the device file with an OVERLAPPED
attirbute or one task pending on a read will cause a write to block  As I
mentioned earlier, I'm not familiar with the GNAT.Sockets implementation
so it is entirely possible that you are seeing the same behavior because of
the socket implementation.

Steve
(The Duck)





  parent reply	other threads:[~2006-01-31  3:02 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
2006-01-31  3:02 ` Steve [this message]
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