Re: Communication speed between blocking call and non blocking cal



You could use event based notification (GetOverlappedResult), APC-based
notification (use an alertable wait and a completion routine with say
WSASend/WSARecv), or I/O completion port based notification (associate a
completion port and use GetQueuedCompletionStatus).

When you use nonblocking I/O, the system may have to perform extra buffering
with your data (copy it into an internal buffer and then return to your
call, with the data to be sent at a later time). Overlapped I/O eliminates
this step, you are telling the system that it will be able to reference your
data buffer until you say that you are done with it. This also gets you out
of having to worry about adjusting the socket send/recv buffer sizes, as you
are controlling the buffering directly yourself and eliminating most of the
middle-man steps that nonblocking I/O introduces.

"Anand Choubey" <AnandChoubey@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DFAC3150-C7E5-4430-9743-20CD922F3941@xxxxxxxxxxxxxxxx
Hi
Thanks for suggestion.

Please give me out line for:

1. how to handle ovelapped mechanism with WSAEventSelect. Because as far
as
I know to get overlapped result we have to wait and then call
GetOverlappedResult.

2. how to handle IOCPmechanism with WSAEventSelect.

Because I got FD_XXX notifications.

And what is extra advantage to use ovelapped and IOCP with
WSAEventSelect???
--
With regards
thanks
Anand Choubey


"Skywing" wrote:

Using overlapped I/O would still be better here, helps eliminate
redundant
buffer copies when you are doing large amounts of data transfer.

"Anand Choubey" <AnandChoubey@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7E1F2B3F-8E4A-420D-A1F8-4A428F8C03C6@xxxxxxxxxxxxxxxx
Hi

Yes i set winsock kernel buffer to 5MB. I checked default socket buffer
was
8KB.
I got good speed and I tested for blocking and nonblocking socket and
got
same speed 97Mbps.

Thanks for help me.
--
With regards
thanks
Anand Choubey


"Arkady Frenkel" wrote:

Do you mean you increased TcpWindowSize ?
TIA
Arkady

"Anand Choubey" <AnandChoubey@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:490A2405-CDE4-4A10-AF53-F1B0B5F20E39@xxxxxxxxxxxxxxxx
Hi
Thanks for reply.
Ultimately I have got good speed with non blocking socket. speed is
around
97Mbps.
Problem was I did not set winsock kernel buffer. Now I set buffer
size
5MB.
--
With regards
thanks
Anand Choubey


"Alexander Nickolov" wrote:

Can't imagine a reason not to. I have no problem with non-blocking
socket and regular select for sure. Make sure you are not starving
the socket - e.g. you always fill its send buffer. Or if it's a
receive
socket - make sure you drain it completely before waiting for
another event. You may get notified with no data in the socket
this way - simply ignore such cases.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

"Anand Choubey" <AnandChoubey@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:2F6B49CF-3B1C-4951-A91B-B6AA61828277@xxxxxxxxxxxxxxxx
Hi
Thanks for reply.
It is TCP socket.
Code is big because it includes business logic also. So i could
not
post
in
newsgroup.
Are we sure nonblockin socket gives high speed with
WSAEventSelect???
--
With regards
thanks
Anand Choubey


"Alexander Nickolov" wrote:

Can you post your code for review? May be a programming
error on your part...

Also, are you talking about sending or receiving data? TCP or
UDP?

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

"Anand Choubey" <AnandChoubey@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote
in
message
news:B3926315-ECC9-47F1-91A8-C9456DCB4E47@xxxxxxxxxxxxxxxx
Hi

As we know there are two main methods for socket communication
1. winsock blocking calls
2. winsock nonblocking calls

I would like to know that which method is faster.
As I tested blocking call is much faster than nonblocking call
(WSAEnumNetworkEvents).

Blocking call gives me speed around 80Mbps whereas nonblocking
call(WSAEnumNetworkEvents) gives me around 10Mbps.
Please suggest me that How to increase speed for nonblocking
call(WSAEnumNetworkEvents).
I tested under windows 2000 Server.
--
With regards
thanks
Anand Choubey














.



Relevant Pages