Click here to Skip to main content
16,016,738 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello,

I coded an application which purpose is to continually exchange data with server. However I would like to have more connections established in this process. Like 10 connections from one process to the server at the same time.

I still doesn't see the concept behind asynchronous handling:

I would like to have it like this ->

CConnection connections[10];

and somewhere handling the receive like this ->

"If I'm ready to receive, then receive data and pass it to currently selected connection."
Like: connections[selected]->HandleRecv(bRecievedData);

Could someone please explain me how to achieve such goal?

Thank you
Posted

1 solution

Download and stydy Echoc.exe - Simple Overlapped Socket Client Sample
http://support.microsoft.com/kb/193066[^]

Regards
Espen Harlinn
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 18-Mar-11 15:17pm    
Interesting work referenced, should help, my 5.
--SA
Espen Harlinn 21-Mar-11 12:40pm    
Thank you, SAKryukov!
Im2N00By 19-Mar-11 15:22pm    
It's little bit more clear now. I will try it with MFC CAsyncSocket for now until I will understand it little bit better.

Thank you
Sergey Alexandrovich Kryukov 20-Mar-11 23:09pm    
I would prefer using sync. sockets (all blocking calls) with threads.
--SA
Espen Harlinn 21-Mar-11 12:43pm    
For a large number "low-traffic" of concurrent users - asynch may provide better performance, while synch sockets are usually easier to implement, and often offers better performance for scenarios involving "few" concurrent users and a lot of traffic.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900