Login  
Search All Forums
Dart Home | PowerTCP Sockets for .NET | Custom Development Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
AuthorForum: PowerTCP Sockets for .NET (Secure and Standard)
Topic: Fastest Method for Async
cambler

From: Redmond, WA USA
Posts: 102
Member Since: 04/14/03
posted June 18, 2003 6:54 PM

Okay, let's talk about the fastest async method. I've come up with three theories:

1. Code a class that has event handlers for both EndSend and EndReceive. Kick it off with a BeginSend(). When EndSend fires, kick off a BeginReceive(). When EndReceive fires, kick off a BeginSend() again. Repeat forever.

2. Same as 1, but turn on AutoReceive and neglect the BeginReceive() call. This seems like it might be theoretically faster.

3. Create a thread that does a for (;;) loop. Inside the loop, to a sync Send(). Turn on AutoReceive, and also have an EndReceive handler.

Which will produce the maximum throughput, presuming that the send/receive round trip time stays consistent?

Christopher
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted June 18, 2003 7:42 PM

I would guess that 2 would be the fastest, but I would want to try it and see for myself if I were implementing it.

cambler

From: Redmond, WA USA
Posts: 102
Member Since: 04/14/03
posted June 19, 2003 1:00 PM

Why do you suspect #2 would be faster than #3?

I did some testing, and #2 beats #1 by a bare fraction. But #3 remains to be seen.

The reason I suspect #3 might be faster is that I don't have to wait for a receive before I do a send. With #3, I'd have multiple sends in the pipeline at any given time, with send and receive running independently.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted June 19, 2003 1:03 PM

I thought 2 would be faster than 1. I did not understand what you were saying in option 3 so I did not consider it.

Since you have already run tests, any discussion seems to be moot at this point. Just use the method you like best.



cambler

From: Redmond, WA USA
Posts: 102
Member Since: 04/14/03
posted June 19, 2003 1:06 PM

The point is that I've not tested #3 yet (and I hadn't tested anything before posting).

Have you, or anyone you know, done a project like #3? With a dedicated thread doing sends, and allowing the main thread to handle EndReceive calls (which, as I understand, fire on their own thread)? It seems like it might be the best way to go, but also that there might be serious pitfalls in doing so.

I'm just trying to do a little research (a little, "Hey, has anyone done this?") before embarking on it.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted June 19, 2003 1:14 PM

I do not know if anyone has attempted that or not. Perhaps someone else will read this and comment.

Sorry I could not help.

cambler

From: Redmond, WA USA
Posts: 102
Member Since: 04/14/03
posted June 19, 2003 1:15 PM

No worries, Tony!

Anyone else played around with this?
Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX