المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : TCP Servers



C# Programming
09-17-2009, 09:31 PM
Hi guys

So the past few weeks I've been doing research and playing around with TCP servers. I've finally got the one type of server architecture down and I understand the why's and the how's.

Basically the server object creates a TcpListener in its own thread to listen for client connections. When this listener thread accepts a client it creates a client object for it and handles communication(which is the blocking type) for that client in its own thread. So 1 thread per client.

I get that this doesn't scale well and why.

Now I need to move on to the non blocking way. I believe its called "asynchronous TCP sockets", using BeginConnect(), BeginAccept(), BeginSend(), BeginReceive(), EndConnect(), EndAccept(), EndSend()and EndReceive()

Now I've found alot of articles but what I really need is a bare bones example and explanation. Alot of these articles are built around custom libraries and implementations of this server architecture and I find it difficult to find the core concepts in between other code.

So my question, can anyone recommend an article where this is explained well enough and in a bare bones type manor? I'm really more interested in how it works instead of copying the code and modifying it for my needs.

Thanks http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif

Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111