Sign in to follow this  

Chat engine

Recommended Posts

Hello all, I'm currently working on a new game, and while I'm still working on the specs for the game, I thought I'd start with some preliminary coding which would come in handy whatever way the game goes. The first thing I wanted to start up was the chat engine. This would be a stand alone server application in order to make it scalable. However, I'm not sure how to setup the sockets on the server side. Since I'm using Java as a a language I have several option to explore: - blocking sockets, these just block untill a client wants to connect - non blocking sockets, these listen for a socket request from the operatin system. The non blocking sockets are much cleaner, but do require more code on the server side to manage everything. Aside from the blocking or non blocking sockets, there is also the question of whether or not to keep the sockets open as long as the user is chatting, or to close them after each request. There are several reasons to keep them open, most importantly because in that way, you can send messages from the server to the client whenever possible. However, when you keep the sockets op, eventually you will run out of sockets (there are only so many sockets availlable on a server). The other way is to close the socket as soon as the current request is processed. This has the advantage of freeing up server sockets for other clients, but it has the disadvantage of not being able to send messages from the server to the client without the client having to first setup a new connection. I'm personally leaning towards non blocking, permanent sockets. But I just thought I'd check with the community to see how others would tackle this problem. mark

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this