[C#] [Guide] Introduction To Asynchronous Server Sockets.

09/20/2012 02:11 Danial Eugen#1
Hello Guys!

First i wanna to introduce myself as i am a new member here also this is my first tutorial at EPVP.
Quote:
My name is [Only registered and activated users can see links. Click Here To Register...], I am from UAE, and i am a C# programmer.


So let's begin our guide.

I. Purpose

The purpose of this tutorial is covering the following aspects

• What is the Asynchronous Calls ?.
• What is the difference between Synchronous and Asynchronous code ?.
• What is the Socket class ?.
• How to create a simple Socket Server


II. Requirements

This guide is written as a beginner guide; However, It is expected that you have a basic knowledge of C# and a working brain.

In order to be able to follow along, you will need:

• Brain.exe
• Microsoft Visual Studio 2008 or later (or equivalent)
• Will to learn


III. Explanations

I will start to explain what i was talking about previously so let's take

What is the Asynchronous Calls ?
•Simply Asynchronous(Non-Blocking) calls are made, but we don't have to wait for them to complete; therefore, the program can resume to the next function without suspending the execution .

What is the difference between Synchronous and Asynchronous code ?
•Unlike Asynchronous Calls, Synchronous(Blocking) program is executed line by line. Each time a function is called, program execution waits until that function returns before continuing to the next line of code.

So we can conclude that using an Asynchronous Call, We can prevent program freeze while doing some Time-Consuming functions.

What is the Socket class ?
•The Socket class allows you to perform both synchronous and asynchronous data transfer between clients and servers.


IV. Implementation

Now we are ready to get started. The first thing we will be doing is creating a new Console Application File->New->Project and giving it any name Ex. Asynchronous Socket Server

-Create a new class and give it a name, i will name mine Socket.cs

V. Conclusion

In the end, you should have learned how to create a socket for your server development also you know what is asynchronous calls and how to use them; However, this guide is just a first step to socket programming.

NOTE :
●If you want to download the solution and test it yourself, you will find it in the attachment.
●Feel free to correct me if i failed to explain something (This is my first tutorial so i may be explained something wrong).
●Also ask any question here and i will be helping you as far as i can...

Best regards.
Danial Eugen .
09/28/2012 00:20 Danial Eugen#2
Does all the effort i made in this guide deserves only 0 comments !
01/04/2013 21:13 »Barney«#3
It helped me, so ... :D