473,320 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

(asynch tcp client) I'm missing something with this example

http://msdn2.microsoft.com/en-us/lib...2a(VS.80).aspx

I was looking at above link and I just don't see the advantage of this. The
main thread is just stopping and waiting for each of the
connects/sends/receives to complete anyway so it seems to me using the
synchronous methods would be much simpler and equivalent as far as
efficiency/performance in this example? What am I missing here? Is it just
that this example is simply to show the structure of putting the begin/end
asynch calls together and not demonstrating a practical use?

any input on this would be greatly appreciated. A good practical example of
asynchronous tcp client/server would be gold to me right now.
Apr 18 '07 #1
6 1946
HI,

Maybe in this case it like that. It's an example after all.

The point is that with an async you can do other stuff (or at the least no
block the UI) while you transfer the data.

"David" <no****@nospam.comwrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
http://msdn2.microsoft.com/en-us/lib...2a(VS.80).aspx

I was looking at above link and I just don't see the advantage of this.
The main thread is just stopping and waiting for each of the
connects/sends/receives to complete anyway so it seems to me using the
synchronous methods would be much simpler and equivalent as far as
efficiency/performance in this example? What am I missing here? Is it just
that this example is simply to show the structure of putting the begin/end
asynch calls together and not demonstrating a practical use?

any input on this would be greatly appreciated. A good practical example
of asynchronous tcp client/server would be gold to me right now.

Apr 18 '07 #2
<"Ignacio Machin \( .NET/ C# MVP \)" <machin TA laceupsolutions.com>>
wrote:
Maybe in this case it like that. It's an example after all.

The point is that with an async you can do other stuff (or at the least no
block the UI) while you transfer the data.
It depends on the situation. In the case of a server, I'd say the main
point of async IO is to be able to handle thousands of clients without
the context switches involved in running thousands of threads.

Chris Mullins is the person to ask though :)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Apr 18 '07 #3
JR

"Jon Skeet [C# MVP]" <sk***@pobox.com???
??????:MP************************@msnews.microsoft .com...
<"Ignacio Machin \( .NET/ C# MVP \)" <machin TA laceupsolutions.com>>
wrote:
>Maybe in this case it like that. It's an example after all.

The point is that with an async you can do other stuff (or at the least
no
block the UI) while you transfer the data.

It depends on the situation. In the case of a server, I'd say the main
point of async IO is to be able to handle thousands of clients without
the context switches involved in running thousands of threads.

Chris Mullins is the person to ask though :)
The main thread is just a harness for the sample routines. It is not a real
user. One should use asynch I/O when one needs it. For example, when you
want your GUI to be responsive even when the other party fails.

JR
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Apr 19 '07 #4
thanks all...

"David" <no****@nospam.comwrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
http://msdn2.microsoft.com/en-us/lib...2a(VS.80).aspx

I was looking at above link and I just don't see the advantage of this.
The main thread is just stopping and waiting for each of the
connects/sends/receives to complete anyway so it seems to me using the
synchronous methods would be much simpler and equivalent as far as
efficiency/performance in this example? What am I missing here? Is it just
that this example is simply to show the structure of putting the begin/end
asynch calls together and not demonstrating a practical use?

any input on this would be greatly appreciated. A good practical example
of asynchronous tcp client/server would be gold to me right now.

Apr 19 '07 #5
The sample is showing you how to do basic async socket programming, but it
is (as you point out) really defeating the purprose by doing so much
waiting.

Async sockets are good for handling lots of sockets very cheaply, and for
helping you not have to create and manage your own threads.

There are a number of better examples that Microsoft has put out. Their
server sample of that same program is a bit better: This creates a server
socket, that just echo's things back to the sender. Pretty straight forward.
http://msdn2.microsoft.com/en-us/library/fx6588te.aspx

There are a ton of examples on CodeProject that use async sockets:
http://www.google.com/search?hl=en&q...om&btnG=Search

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins

"David" <no****@nospam.comwrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
http://msdn2.microsoft.com/en-us/lib...2a(VS.80).aspx

I was looking at above link and I just don't see the advantage of this.
The main thread is just stopping and waiting for each of the
connects/sends/receives to complete anyway so it seems to me using the
synchronous methods would be much simpler and equivalent as far as
efficiency/performance in this example? What am I missing here? Is it just
that this example is simply to show the structure of putting the begin/end
asynch calls together and not demonstrating a practical use?

any input on this would be greatly appreciated. A good practical example
of asynchronous tcp client/server would be gold to me right now.

Apr 19 '07 #6
thanks Chris. Its appreciated.

"Chris Mullins [MVP]" <cm******@yahoo.comwrote in message
news:eC**************@TK2MSFTNGP04.phx.gbl...
The sample is showing you how to do basic async socket programming, but it
is (as you point out) really defeating the purprose by doing so much
waiting.

Async sockets are good for handling lots of sockets very cheaply, and for
helping you not have to create and manage your own threads.

There are a number of better examples that Microsoft has put out. Their
server sample of that same program is a bit better: This creates a server
socket, that just echo's things back to the sender. Pretty straight
forward.
http://msdn2.microsoft.com/en-us/library/fx6588te.aspx

There are a ton of examples on CodeProject that use async sockets:
http://www.google.com/search?hl=en&q...om&btnG=Search

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins

"David" <no****@nospam.comwrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
>http://msdn2.microsoft.com/en-us/lib...2a(VS.80).aspx

I was looking at above link and I just don't see the advantage of this.
The main thread is just stopping and waiting for each of the
connects/sends/receives to complete anyway so it seems to me using the
synchronous methods would be much simpler and equivalent as far as
efficiency/performance in this example? What am I missing here? Is it
just that this example is simply to show the structure of putting the
begin/end asynch calls together and not demonstrating a practical use?

any input on this would be greatly appreciated. A good practical example
of asynchronous tcp client/server would be gold to me right now.


Apr 23 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: cjl | last post by:
Hey all: I know that it is silly in the age of Google to 'lose' something on the internet, but I recently checked out a project that had implemented a database with a subset of SQL in pure...
11
by: Glen Wolinsky | last post by:
This is my first attempt as asynchronous processing. I have created a small test app as proof of concept, but I am having one proglem. In the example (code listed below), my callback routine has...
2
by: ghost | last post by:
As the Subject indicates I have written a web page that makes use of several web service calls. Some of the web service calls are very fast so they called synchronously. Some web service calls...
5
by: Ric | last post by:
I created a page in ASP.Net (with no buffering) that does the following: Output line #1 FLUSH {wait 1 second} Output line #2 {wait 1 second} Output line #3 FLUSH
1
by: Sean | last post by:
I am looking at using delegates to perform an asynchronous call. There will be a callback invoked at the end of the call. The client thread will wait on the WaitHandle from IAsyncResult (which is...
4
by: EM_J | last post by:
I am implementing this interface in one of my pages. The RaiseCallbackEvent method runs a task for about 3 seconds. I've noticed when I am on that page and click a tab to navigate to another...
0
by: =?Utf-8?B?Um9iIEM=?= | last post by:
I have an application written in VC++ using MFC that calls into web service written in C#. I am developing in VS2005. I am debugging my C++ app while I have attached my Webservice project to the...
0
by: Patino | last post by:
I have a particular WS consumer application (Windows app) that was not able to read an error from the WS app because it was calling a method asynch. The client app just hangs there. But once I...
6
by: Frank Hauptlorenz | last post by:
Hello out there, I have 2 services running. The first one runs in session mode and the 2nd not. The first one should call an operation of the 2nd one asynchronously, because this is doing some...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.