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: Threading issues
cambler

From: Redmond, WA USA
Posts: 102
Member Since: 04/14/03
posted April 24, 2003 5:35 PM

Let's talk threading and events.

When I start up 10 Tcp objects with BeginConnect(), and set the callback for all of them to an event handler in my main application, am I to understand that I get 10 threads, one for each Tcp object? Then each thread fires the event to my main thread, which handles it, and then the Tcp object's thread will exit?

In other words, the Tcp object lives on my main thread, but the BeginConnect() call is run on its own thread?

Is it the same for BeginSend() and BeginReceive()

For that matter, may I have a BeginSend() and a BeginReceive() running at the same time on the same Tcp object?

I'm presuming that having all 10 Tcp objects use the same event handler (on my main thread) often blocks. In other words, if Tcp object 1 has fired an event, that event is processed on my main thread, and Tcp object 2, even though it fired its event immediately thereafter, was waiting for my main thread to finish. Is this correct?

Is there an architecture that is ideal for multiple Tcp object, all sending and receiving at the same time, such that I minimize (or eliminate) any waiting or blocking time?

Are we having fun yet? :-)

Christopher
cambler

From: Redmond, WA USA
Posts: 102
Member Since: 04/14/03
posted April 25, 2003 10:42 AM

Yep, I've confirmed that I cannot have a BeginSend() and a BeginReceive() running at the same time. I can call one from the event handler of the other, but that means that I'm not running as absolutely fast as I can, right?

The whole goal here is to get maximum throughput on the socket. I'm firing off short commands to a server and getting short responses back. But since I have to wait to do a BeginReceive() until my BeginSend() is done, everything is done serially.

I'd much rather rapid-fire off commands and handle responses as they come in.

Any clue? This is a blocking issue for me right now...
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted April 25, 2003 4:32 PM

Hi,
Please see my direct response.
-ken
cambler

From: Redmond, WA USA
Posts: 102
Member Since: 04/14/03
posted April 25, 2003 6:38 PM

I have found the solution.

The undocumented (in SSL docs, hint hint) AutoReceive feature.

Christopher
Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX