Jump to content
  • Advertisement
Sign in to follow this  

Chat engine

This topic is 4477 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!