WARNING AND NOTICE

All tricks in this blog are only for educational purpose. Learn these tricks only for your knowledge. Please donot try these to harm any one. We will not take any responsibility in any case. All softwares and tools on this site are here for private purposes only and If you want to use a software for business purpose, please purchase it. I do not host many of these tools. I Post links that I have found from numerous Search engines. I will not be responsible for any of harm you will do by using these tools.

Readmore

Thursday, September 23, 2010

Building a Java chat server

In this tutorial, you’ll build a simple, centralized, connection-oriented Java server. In doingso, you’ll learn a basic framework that you can use when creating such a server, using time-honored techniques that work well in many situations. We’ll also examine some of the limitations of this framework and explore ways of getting around them. What is a connection-oriented server? Generally speaking, the job of any server is to provide a centralized service. However, thereare many different ways of providing services, and many different ways to structure the communications.Chat is roughly described as a connection-oriented service, because a user establishes a connection and maintains that connection, sending and receiving text for the duration of thesession.This is in contrast to the Web, where the protocol is (at least in theory) transactional — the browser asks for a page, and the server sends it; the connection is then closed. (In practice,the connection is kept open and reused, but this is more a speed-optimization than a structuring metaphor.)We’ll be creating a stripped-down, connection-oriented server. Learning the basic framework will help you a great deal in creating other connection-oriented servers in the future. Why create from scratch? In creating this prototype server, we’ll be using nothing more than the basic packages built into every Java implementation. This allows us to explore server programming at the very lowest level possible in the Java language.There are certainly many systems available that can take care of many of these networking details for you. In many cases, the best real-world solution is to use an existing framework,because it often provides useful features such as fault-tolerance, load-balancing, and sessioning.It is, nevertheless, crucial to understand how these things work at the lowest level. No existing solution is perfect for all problems, and existing solutions often have minor flaws that your code must work around. Simply choosing the right pre-packaged solution takes a discriminating eye that has been educated as to the trade offs inherent in various techniques. Why a framework? The word framework has a technical definition within the object-oriented community — it.

Download
Building a Java chat server.

0 comments:

Post a Comment