March 07, 2012 SocketStream exceptions and disconnect handling | ||||
---|---|---|---|---|
| ||||
Attachments:
| Hi all, I'm trying to handle disconnections transparently on SocketStream. I thought something like this: void send(ubyte[] buffer) in { assert(buffer.length > 0); } body { if (!stream.isAlive) connect(); auto sent = stream.write(buffer); if (sent == 0) throw new Exception("Error while writing"); } But that's impossible because isAlive doesn't exists for SocketStream and I can't get the underlying socket object. Is that something missing or should I handle it differently? Pedro Lacerda |
Copyright © 1999-2021 by the D Language Foundation