Socket.send

2011-09-26 Thread Andrea Fontana
I'm working on a simple server written in d. I use a SocketSet to check requests from clients. I have to send back response and close connection. Is there a method to check if socket sent data or not with an async socket (so i can close it)?

Re: Socket.send

2011-09-26 Thread mta`chrono
Am 26.09.2011 18:09, schrieb Andrea Fontana: > I'm working on a simple server written in d. I use a SocketSet to > check requests from clients. > > I have to send back response and close connection. Is there a method > to check if socket sent data or not with an async socket (so i can > close it)?

Re: Socket.send

2011-09-26 Thread Andrea Fontana
I'll try to explain it better. if i write: socket.send(...); socket.close(); socket = null; and send is async, i guess sending will not work properly in this way. How do i know if send() is still sending or not?

Re: Socket.send

2011-09-27 Thread Regan Heath
On Tue, 27 Sep 2011 01:40:49 +0100, Andrea Fontana wrote: I'll try to explain it better. if i write: socket.send(...); socket.close(); socket = null; and send is async, i guess sending will not work properly in this way. How do i know if send() is still sending or not? I am not su

Re: Socket.send

2011-09-27 Thread Regan Heath
On Tue, 27 Sep 2011 10:53:13 +0100, Regan Heath wrote: .. call recv, if != 0; check for WSAEWOULDBLOCK/EWOULDBLOCK, call select, loop until recv returns 0 .. In this loop you will also need to check for WSAECONNRESET/ECONNRESET to detect a badly behaved remote end calling close without

Re: Socket.send

2011-09-27 Thread Andrea Fontana
omitted ...] // Build http reply [... omitted ...] socket.send(reply); socket.shutdown(SocketShutdown.BOTH); } and then wait for client to close connection?

Re: Socket.send

2011-09-27 Thread Regan Heath
(httpRequest.isCompleted) { // Parsing request headers [... omitted ...] // Build http reply [... omitted ...] socket.send(reply); socket.shutdown(SocketShutdown.BOTH); } and then wait for client to close connection? Almost. If the client sends additional data which you do not re