[Guide] Asynchronous Socket Server [For Development Purpose]

09/17/2012 19:30 Danial Eugen#1
Hello Guys!

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 for Conquer developing.


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/17/2012 20:45 I don't have a username#2
This belongs in the programming forum and holy fuck VS 2012 is ugly as fuck.
09/17/2012 20:54 Arco.#3
I'm sticking with 2010. It's preeeetty.
09/17/2012 21:03 I don't have a username#4
Quote:
Originally Posted by Arco. View Post
I'm sticking with 2010. It's preeeetty.
Same, I'll never go with 2012 :cool:
09/17/2012 21:53 Danial Eugen#5
Quote:
Originally Posted by I don't have a username View Post
This belongs in the programming forum and holy fuck VS 2012 is ugly as fuck.
I find Visual Studio 2012 with .NET 4.5 APIs for asynchronous development very satisfying, btw you still can use 2008~2010 for this tutorial :D anyway i hope you liked my very first topic here.
09/17/2012 21:58 I don't have a username#6
Quote:
Originally Posted by Danial Eugen View Post
I find Visual Studio 2012 with .NET 4.5 APIs for asynchronous development very satisfying, But you still can use 2008~2010 for this tutorial :D anyway i hope you liked my very first topic here.
I just want to point out that you didn't even use anything that isn't available all the way down to 3,5.

Thought you could've used this then.
[Only registered and activated users can see links. Click Here To Register...]

And sure this is going to be useful for some :)
09/17/2012 22:03 Danial Eugen#7
Quote:
Originally Posted by I don't have a username View Post
I just want to point out that you didn't even use anything that isn't available all the way down to 3,5.

Thought you could've used this then.
[Only registered and activated users can see links. Click Here To Register...]

And sure this is going to be useful for some :)
I was just speaking about VS2012 benefit for my personal work;However, this is a beginner's guide and i wanted it to work with the big portion of people who still have 2005~2010 VSs
09/17/2012 22:20 badguy4you#8
ofc this thread will help a lot of ppl good luck.


#Request sticky this will be very useful at any server development.
09/17/2012 22:46 Spirited#9
I might not agree with the way it's implemented, and I definitely don't agree with it being stickied, but it's a good guide for an introduction to managing a game server. I can tell you put a lot of time and work into this post, and hopefully it'll be there for anyone searching for something like this. Good job.
09/17/2012 23:18 Danial Eugen#10
Quote:
Originally Posted by Fаng View Post
I might not agree with the way it's implemented, and I definitely don't agree with it being stickied, but it's a good guide for an introduction to managing a game server. I can tell you put a lot of time and work into this post, and hopefully it'll be there for anyone searching for something like this. Good job.
As i told before i kept everything clear and simple because this is not a pro guide

And thanks for your comment.
09/18/2012 10:03 Korvacs#11
I did a search and was unable to find 'Brain.exe' could you provide some sort of link or download?

In all seriousness a very nice guide into the topic, well laid out and easy to understand. I dont think a sticky for this is necessary though perhaps if you do a large collection of guides then one sticky could contain links to them all.

Also i love the 2012 design, whats wrong with you guys, embrace metro style apps ffs lol (this isnt a metro app, but is themed like one)
09/18/2012 17:46 Danial Eugen#12
Quote:
Originally Posted by Korvacs View Post
I did a search and was unable to find 'Brain.exe' could you provide some sort of link or download?

In all seriousness a very nice guide into the topic, well laid out and easy to understand. I dont think a sticky for this is necessary though perhaps if you do a large collection of guides then one sticky could contain links to them all.

Also i love the 2012 design, whats wrong with you guys, embrace metro style apps ffs lol (this isnt a metro app, but is themed like one)
xDD thank you very much for your nice comment Krovacs and yea you are one of those i appreciate a lot here at EPVP.

And i totally agree with you about VS2012, personally i like its style more than that of 2010.
12/14/2012 13:41 kondos#13
Good Job Ma boy
12/14/2012 20:42 AudaciousOrange#14
Can't believe i missed this. Thankyou.

Really good tutorial, learnt a couple things i'd looked over.