------art_26790_14024829.1185782262237
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

2007/7/29, Emmanuel Gaillot <emmanuel.gaillot / gmail.com>:
> I'd like to write a test that ensures a Server application correctly
> handles closed client connections -- more specifically: I want to set
> up a TCPServer, then a client, then close the client, then attempt to
> write on the client Connection from server side -- and make sure no
> Error gets fired.
>
> To my great surprise, the test doesn't behave in any predictible way
> -- sometimes it passes, sometimes it fails.

> Any idea of what's going on?
> Any suggestion about how I could make this piece of code predictible?

I guess it's a combination of timing and buffering issue. With a
modified version I get

RKlemme@padrklemme1 ~
$ ruby ruby/socket-test-1.rb
(Unexpectedly) passed 2 times;
{Errno::ECONNABORTED	98}

(see attachment)

Kind regards

robert

------art_26790_14024829.1185782262237
Content-Type: application/x-ruby; name="socket-test-1.rb"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="socket-test-1.rb"
X-Attachment-Id: f_f4qo4qxd

cmVxdWlyZSAnc29ja2V0JwpyZXF1aXJlICdwcCcKCmNvbnNlY3V0aXZlX3B1dHNfdG9fYXR0ZW1w
dCA9IDEKb2tfY291bnRlciA9IDAKZXJyb3JfY291bnRlciA9IEhhc2gubmV3IDAKc2VydmVyID0g
VENQU2VydmVyLm9wZW4gJzEyNy4wLjAuMScsIDQ4MDcKCjEwMDAudGltZXMgZG8gfGl8CiAgIyBw
dXRzICJydW4gI3tpfSIKICAgIGNsaWVudCA9IFRDUFNvY2tldC5vcGVuICcxMjcuMC4wLjEnLCA0
ODA3CiAgICBjb25uZWN0aW9uID0gc2VydmVyLmFjY2VwdAogICAgc2xlZXAgMC4xCiAgICBjbGll
bnQuY2xvc2UKCiAgICBiZWdpbgogICAgICBjb25zZWN1dGl2ZV9wdXRzX3RvX2F0dGVtcHQudGlt
ZXMge2Nvbm5lY3Rpb24ucHV0cyAiSGVsbG8hIn0KICAgICAgb2tfY291bnRlciArPSAxCiAgICBy
ZXNjdWUgRXhjZXB0aW9uID0+IGUKICAgICAgZXJyb3JfY291bnRlcltlLmNsYXNzXSArPSAxCiAg
ICBlbmQKZW5kCnNlcnZlci5jbG9zZQoKcHV0cyAiKFVuZXhwZWN0ZWRseSkgcGFzc2VkICN7b2tf
Y291bnRlcn0gdGltZXM7IgpwcCBlcnJvcl9jb3VudGVyCg------art_26790_14024829.1185782262237--