String line=new String();; BufferedReader in = null; PrintWriter out = null; //vechile.parsestring1 ps = new vechile.parsestring1(); try{ in = new BufferedReader(new InputStreamReader(client.getInputStream())); out = new PrintWriter(client.getOutputStream(), true);
} catch (IOException e) { System.out.println("in or out failed"); System.exit(-1); }
// Get the content pane, set layout, add to center Container content = this.getContentPane(); content.setLayout(new BorderLayout()); content.add(scrollingArea, BorderLayout.CENTER); this.setSize(300,250); } //End Constructor
public void listenSocket(){ try{ server = new ServerSocket(8080); } catch (IOException e) { System.out.println("Could not listen on port 8080"); System.exit(-1); } while(true){ ClientWorker w; try{ w = new ClientWorker(server.accept(), textArea); Thread t = new Thread(w); t.start(); try{ t.join(); }catch(InterruptedException IE){ System.out.println("InterruptedException:"+IE.getMessage()); } } catch (IOException e) { System.out.println("Accept failed: 8080"); System.exit(-1); } } }
protected void finalize(){ try{ server.close(); } catch (IOException e) { System.out.println("Could not close socket"); System.exit(-1); } }
public static void main(String[] args){ SocketThrdServer frame = new SocketThrdServer(); frame.setTitle("Server Program"); WindowListener l = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; frame.addWindowListener(l); frame.setSize(300,200); frame.setVisible(true); frame.listenSocket(); } }
-----------------------
Thanks.
Related Pages:
Synchronization probleam - Java Server Faces Questions Synchronization probleam Hi friend
my question is why it is consuming 99% of cpu time. if i discarded that vechile package it doesnt affect the programme
Here is the new code please tell me how to synchronize
Synchronization probleam - Java Server Faces Questions Synchronization probleam
Hi friends
My java multithreading listner consumes 99% of cpu time.please tell me how to synchronize this programme so that it runs normally like any other programmes.
Here is my code
Synchronization
Synchronization what is the use of synchronization
Synchronization
Synchronization i want code for synchronization using in jsp and servlets
synchronization
synchronization what is about static method synchronization&instance method synchronization
Synchronization and interlocking Synchronization and interlocking What are the different level locking using the synchronization keyword
java synchronization
java synchronization What is synchronization and why is it important
Synchronization Synchronization
 ... consistency errors. By the synchronization tool we can avoid this problem. In other.... Remember the following points related to lock and synchronization:
Only
Java synchronization
Java synchronization What is synchronization and why is it important? Synchronization is best use with the Multi-Threading in Java. Synchronization is the way to make our program safe. As we know when we have two
Java Synchronization
Java Synchronization What is synchronization and why is it important? Synchronization is best use with the Multi-Threading in Java. Synchronization is the way to make our program safe. As we know when we have two
Synchronization on threads Synchronization on threads what is the difference between synchronized method and block??
Hello Friend,
Differences:
1)Synchronized blocks place locks for shorter periods than synchronized methods.
2)Synchronized
Describe synchronization in respect to multithreading.
Describe synchronization in respect to multithreading. Hi,
Describe synchronization in respect to multithreading.
thanks,
Are you... the synchronization in respect to multithreading
Synchronization - Java Interview Questions
Synchronization Dear Sir
my doubt is
If we cannot use synchronization for a class then how a vector class is called as synchronized
difference between lock and synchronization
difference between lock and synchronization Hi,
I am new in java please anyone tell me difference between lock and synchronization in java.
its... and Synchronization
Synchronization with Multithreading - Java Beginners Synchronization with Multithreading
Hi Deepak,
what i know abt synchronization is , we can implement synchronized keyword...,
Synchronization :
Two or more threads share the same resource (variable or method
Synchronization in cluster - Development process Synchronization in cluster I have a scenario to implement.
we have.... Hi,
Synchronization is a process of controlling the access... is in the process of using or updating the object's value. Synchronization prevents
Thread Synchronization in Java
Thread Synchronization in Java
Sometimes, when two or more threads need shared... as thread synchronization.
The thread synchronization is achieved through... to be synchronized
}
Object in Java which have synchronization block
Java :Thread Synchronization
Java :Thread Synchronization
This section explains how to use concept of synchronization in java Thread.
Thread Synchronization : .
Java supports multi... of program. So for the multi-threaded application,
synchronization of java
collections
collections what is meant by synchronization
collections
collections what is meant by synchronization
jsp drop down without refresh - JSP-Servlet
jsp drop down without refresh Sir
I have tried two depenedent jsp dropdown in jsp page,But the probleam is when i select first drop down its... jsp same probleam also arise. Please tell me how to use the drop down without
SubText Plugin
and handling, synchronization, context-sensitive behavior, performance optimizations
jsp dropdown refresh - JSP-Servlet
jsp dropdown refresh Sir
Thank u for your jsp code for dependent dropdown list, i used it in different table for data extraction but the probleam during data extraction when i select first drop down its refresh then 2nd
Interview question - Java Interview Questions
Interview question
Hi Friends,
Give me details abt synchronization in interview point of view.
I mean ow to explain short and neat. Thanks
unable to see the output of applet. - Applet
there is programme on that link.I exactly dont know what probleam u r facing... with "appletviewer name_of _the_html_file"
I hope it solves your probleam
Logical error - Java Magazine
Logical error hi guys...
I am facing some probleam in do-while loop so
plz check out my code and inform me whats wrong with this code
thanks.....
import java.io.*;
class searchex
{
String str=new String
ArrayList and Vector
ArrayList and Vector hello,
Why ArrayList is faster than Vector?
hii,
ArrayList is faster than Vector, because ArrayList is not synchronized. Synchronization will reduce the performance of Vector
regarding java - JDBC
think that is the only option to rectify ur probleam.
for more information
tread - Java Beginners
tread what is a thread and synchronization? give real time example...()
{
....
}
}
Synchronization is best use with the Multi-Threading in Java, Synchronization is the capability to control the access
JAVA - Java Beginners
JAVA Dear Sir,
Kindly guide me the definitions in short form (4 to 5 lines) for the following in JAVA, please.
1.Layout Manager
2.Dynamic Method Dispatch
3.Thread Synchronization
4.Abstract Class
5.Over riding methods
corejava - Java Beginners
Deadlock Core Java What is Deadlock in Core Java? Deadlock is nothing but accessing a same space by different by different programs at the same time . To avoid this problem java has a concept called synchronization
Caringorm in flex
complex state and data synchronization between the client and the server, while
MultiThreading
MultiThreading In MultiThreading....I'm using Hashmap ....Is there any deadlock occurs?
HashMap has synchronization issues in multithreading. Simultaneous access to hash map must be handled by the programmer
Java Interview Questions 3
that observe Observable objects.
Question: What is synchronization and why..., synchronization is the capability to control the access of
multiple threads to shared resources. Without synchronization, it is
possible for one thread to modify
use of synchronozation - Java Interview Questions
is not synchronization and not athread safe,so what are the advantages of synchronization with examples. Hi friend,
Synchronozation.... Synchronization is
the keyword to avoid concurrent access to critical section
of the code
Multithreading ? - Java Interview Questions
Multithreading ?
Hi Friends,
I am new to java , am not clear with Multithreading. Multithread will cause deadlock. We can implement Synchronization keyword or singlethreadmodel interface to avoid deadlock
Java News in July 2007
implementations; moreover features like synchronization tools, an XML generator
Mylyn-Mantis Repository Connector
not be
entered.
Scheduled Synchronization now correctly synchronizes
when triggered by Mylyn. Synchronization speed will greatly depend
Hibernate Synchronizer
by manually launching the synchronization process if that is your
prefrence...). When the synchronization process occurs, only the base classes
JAVA - Java Beginners
Method Dispatch
3.Thread Synchronization
4.Abstract Class
5.Over riding methods....
3)Thread Synchronization-Threads commonly share the same memory space area.... The synchronization tool avoid this problem by allowing one thread to access
Core Java Interview Question, Interview Question
by objects that observe Observable objects.
Question: What is synchronization and why is it important?
Answer: With respect to multithreading, synchronization.... Without synchronization, it is possible for one thread to modify a shared object