Author Topic: doing so solves the multi-client  (Read 266 times)

hvkyez49

  • Senior
  • ****
  • Posts: 273
    • View Profile
doing so solves the multi-client
« on: December 20, 2013, 07:35:59 am »
A good introduction to Java Socket Programming Articles
Client code is accepted customers keyboard input and output that information, and then outputs End used to do exit logo. The program simply for communication between two computers. If multiple clients simultaneously access a server? You can try to re-run a client, the result will be throwing an exception. So many clients how to achieve it?
In fact,cheap ugg boots for sale, a simple analysis,Ugg Boots Cheap, we can see that the main customers and service communication channel is Socket itself. The server via the accept method is agreed and customers to establish communications. So that when customers Socket while. Also make use of the server has a connection for communication. It is so long as we exist multiple connections on it. So our program can be changed to the following: This is just to add an outer While loop. The purpose of this cycle is that when a customer comes in for its distribution on a Socket until the client and server to complete an interaction here is the customer receives End message. So now on the realization of a multi-client interaction,Cheap Ugg, but the problem again,ugg uk, doing so solves the multi-client, but is queued execution. That is when a client and server to complete a communication under a customer can come in and server interaction. Can not do both services. So how can simultaneously achieve both interact with each other and can also exchange it? Obviously this is a parallel problem. So the thread is the best solution then the following question is how to use threads. The first thing to do is to create a thread and makes it possible to contact and network connections. Then by a thread to perform the operation to be performed earlier thread run method must be rewritten. The run method is doing. Is just doing single-threaded version of the main. Therefore,Ugg Boots Sale, our program has become such:
相关的主题文章:

Share on Bluesky Share on Facebook