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)?
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)?
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?
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
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
omitted ...]
// Build http reply
[... omitted ...]
socket.send(reply);
socket.shutdown(SocketShutdown.BOTH);
}
and then wait for client to close connection?
(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