Couple of Questions

01/26/2013 13:41 shadowman123#1
im studying Socket atm and got 2 questions to ask :-

1st : i know that there r 2 types of sockets Async which doesnt block the main thread from working and the other type is Sync which does .. so my question is why would i use smthing that block the main thread while i can use the same one without blocking ? in other way when should i use Sync Socket

2nd : when i make Server / Client should i code them both in the same Projects Or i can do each of them in Separate ones ?

thx in Advance
Regards
Shadowman123
01/26/2013 16:42 ShittyMod#2
[Only registered and activated users can see links. Click Here To Register...]
01/26/2013 16:43 shadowman123#3
and for the 2nd question ?
01/26/2013 16:46 ShittyMod#4
Quote:
Originally Posted by shadowman123 View Post
and for the 2nd question ?
That doesn't really matter. It's probably more convenient to have both the server and the client project in one solution since you can easily browse between the two when doing changes.
01/26/2013 16:55 Super Aids#5
1. Always use async whenever possible in the end it will make your performance better because with sync sockets you actually do not have so much control on the end as you may think, so you can't really optimize them and same goes with async sockets, but you don't need much more control for them actually. If you handle a single connection only then syunc sockets can be fine, but with multiple connections always use async.

2. I assume you're using Visual Studio. Your solution can have multiple projects, use seperate projects, because a client and a server is not the same thing and only thing they might share is the socket library, so what you can do is making 3 projects. A library project and then 2 projects for your client and server.
01/26/2013 19:43 pro4never#6
How you organize your projects is personal preference for the most part but it's best to consider how related things are.


For example... should the client contain the server?... no, that would make no sense to do. As such they should generally be different projects (can be part of the same solution. That makes no real difference besides how you view things inside visual studio).


You do get into more complex things though. For example game and login server. There's no good reason why they cannot be the same project but most people will seperate them for a few reasons.

#1: Scalability: If you ever had the need, you could run the login server and game servers on different hosts. Also allows for multiple game servers with one login server, etc.

#2: Redundancy. If your login server fails, you don't really want it to take the game server with it and vice versa. You could have the login server ensure that the game server is running/responding before forwarding the connection (if not give a user friendly error message) as well as many other things.



As already mentioned, it's often times handy to write a library for your more commonly used systems such as your network system, database setup and many other things that you may wish to use in more than one project.
01/27/2013 01:11 PERROSKI#7
alguno conose a CALIPSOGAMERS¿
01/28/2013 10:35 Super Aids#8
@Server layout

Also host the database on another server, that way each auth server could always authenticate from the same db.
01/28/2013 19:47 shadowman123#9
well i'd like to Login Panel which the user have to Enter his Conquer Account and password if they r wrong he wont get it if its the name of character he Entered will be added to Member List .. any1 know how to make it ( Mechanism )
01/29/2013 08:34 Super Aids#10
A simple sql query like "select * from accounts where username = 'uisernamehere' and password = 'password'".

Remember don't use the code above directly as it will leave it open to sql injection.

Uhmm but you get it.