Re: Socket switch delay
From: mil (mil_at_discussions.microsoft.com)
Date: 08/24/04
- Next message: Alexander Nickolov: "Re: Socket switch delay"
- Previous message: Alexander Nickolov: "Re: Socket switch delay"
- In reply to: Alexander Nickolov: "Re: Socket switch delay"
- Next in thread: Alexander Nickolov: "Re: Socket switch delay"
- Reply: Alexander Nickolov: "Re: Socket switch delay"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 24 Aug 2004 12:21:14 -0700
"Alexander Nickolov" wrote:
>(and I noticed you don't do overlapped receive at the server!)
The receive operation in the server is overlapped, first I receive a header
which describes what is coming (with one recv competion io) and then I setup
buffers and wait for all the data I should be receiving, through the
completion IO. If not all the data comes back, I calculate the right offsets
and wait again for the completion io.
I didn’t send you that part of the code because it is too long.
>would you set the send buffer size to zero on a non-overlapped
>socket escapes me...).
So I get better performance(?) Since I am sending all the data at once using
WSA buffers why do I need to copy them again? Of course I changed that in the
server (so the user can disable the 0 buffering, maybe I should make it
optional in the client too).
>One glaring error is your client does not check it sent all data in one go
Hmm, you are right. I thought when I send data it always sends them all or
it returns an error. I also thought that only the receive can send partial
buffers where the send always sends the whole thing or nothing.
I think I got this whole thing wrong.
>though I have no idea if this is your problem. So when you use a >single socket, what exactly happens with this code and on which >side?
If the previous assumption of mine, is wrong, then that must be the problem.
Because when the client sends data while the server also sends data, the
connection fails and the server socket stays locked for a minute or two.
>Finally, I've never mixed overlapped with non-overlapped I/O
>on the same socket. Could that be your problem?
I didn’t mix the two models, only the client is not using Overlapped IO. The
server is using it for all communication and file writing.
The problem must be the fact that I don’t “expect” the send command to send
partial buffers. And I am not taking into account that in both the client and
the server code. Where for the receive, I “obey” the rules.
So only when I am using a single socket and both client and server are
sending data, the send-operation does not send all the buffers in one go and
“asks me” to try again (and my code doesn’t handle this condition).
I am not saying that this cannot happen with the current code as well, but
it seems that it mostly happens when both sides try to talk over the same
socket.
I will change the code accordingly to take this into account at both sides.
Thanks for pointing out all these “omissions” (to put it kindly) in my code ;)
Now back to the drawing board for me :( I am going to add the checking for
the send operations in client and server then try again with a single socket.
mil
- Next message: Alexander Nickolov: "Re: Socket switch delay"
- Previous message: Alexander Nickolov: "Re: Socket switch delay"
- In reply to: Alexander Nickolov: "Re: Socket switch delay"
- Next in thread: Alexander Nickolov: "Re: Socket switch delay"
- Reply: Alexander Nickolov: "Re: Socket switch delay"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|