Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Swing-AWT swing chatt program
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Magesh Doss.M
swing chatt program
1 Answer(s)      3 years and 6 months ago
Posted in : Swing AWT


how to invoke the code from JTextArea to Socket


Advertisement
View Answers

March 12, 2011 at 8:21 AM


package magesh;

import java.net.Socket; import java.io.DataInputStream; import java.io.PrintStream;

public class Client {

public Client(){
    DataInputStream dsc,dkb;
    PrintStream ps;
    try{
        System.out.println("Client look at 10001");
        Socket s = new Socket("localhost",10001);
        System.out.println("Connect establish by client");
        dsc = new DataInputStream(s.getInputStream());
        dkb = new DataInputStream(System.in);
        ps = new PrintStream(s.getOutputStream());
        while(true){
            System.out.println("Client : ");
            String s1 = dkb.readLine();
            ps.println(s1);
            String s2 = dsc.readLine();
            System.out.println("Server : "+s2);
            if(s2.equalsIgnoreCase("bye")||s1.equalsIgnoreCase("bye")){
                break;
            }

        }
    }catch(Exception ex){
        System.out.println("Error : "+ex.getMessage());
    }
}
public static void main(String[] args) {

    new Client();
}

}



Related Tutorials/Questions & Answers:
swing chatt program
swing chatt program  how to invoke the code from JTextArea to Socket   package magesh; import java.net.Socket; import java.io.DataInputStream; import java.io.PrintStream; public class Client { public Client
Swing Program
Swing Program  Write a java swing program to calculate the age from given date of birth
Advertisements
swing program
swing program  Write a java swing program to getname and email id. Display the message if email id contains the name of theuser
Swing Program
Swing Program  write a java swing program to get user name and password. The name contains only characters while password is masked with the character "*". Apply checks for all validation
Swing Program
Swing Program  Write a java swing program that takes name and marks as input with all validation. The name and marks will be displayed in message box when user clicks on a button
Swing Program
Swing Program  Write a java swing program to search the details of the students. Searching is performed on student's first name. The details of all those students having same name as in given in searching criterion
Swing program
Swing program  Write a java swing program to get name and email id. Display the error message if email id is not in xxxxx@xxxx.xxx format.   import java.awt.*; import java.sql.*; import javax.swing.*; import
Swing Program
Swing Program  write a java swing program to get username and password. The name contains only characters while password is masked with the characters "*". Apply checks for all validation.   import javax.swing.*; import
swing program
swing program  Iam using one JFrame and 4 JPanels one JTabbedPane. my problem is next, previous buttons. when click next button visible some JPanels,again press visble another JPanels. also previous button. how to write the logic
swing program for decimal to binary
swing program for decimal to binary  swing program for decimal to binary
Program for Calculator - Swing AWT
Program for Calculator  write a program for calculator?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/example/java/swing/calculator-in-swing.shtml Hope that it will be helpful
Java Program - Swing AWT
Java Program  A program to create a simple game using swings.  Hi Friend, Please visit the following link: http://www.roseindia.net/tutorial/java/swing/guessNumber.html Thanks
Java Program - Swing AWT
Java Program  A java Program that send message from one computer to another and what are the requirements
Java Program - Swing AWT
Java Program  A Java Program to send message from one computer to another
Java Program - Swing AWT
Java Program  A Java Program that display image on ImageIcon after selecting an image from the JFileChooser
Java Program - Swing AWT
Java Program  Write a Program that display JFileChooser that open a JPG Image and After Loading it Saves that Image using JFileChooser  Hi Friend, Try the following code: import java.io.*; import java.sql.
swing program plz urgent sir - Java Beginners
swing program plz urgent sir   hi sir,i waan a jtable swings program table having column names "itemid","price".Initially table having single empty row.whenever we click the "enter" button automatically new row will be insert
opening internet browser in java program - Swing AWT
opening internet browser in java program  i want a code to open the internet browser in swing program using JFrame.  Hi Omkar, Use the following code: 1) 'OpenBrowser.java' import javax.swing.*; import
swing
swing  Write a java swing program to delete a selected record from a table
problem in swing program for opening two windows with same login credentials
problem in swing program for opening two windows with same login credentials  I Face two problems while writing the code in swing program 1.i developed one application using swings that has username,password when i login
Swing
Swing  Write a java swing program to search the details of the students. Searching is performed on studentā??s first name. The details of all those students having same name as in given in searching criterion will be displayed
Swing
Swing  Write a java swing program to search the details of the students. Searching is performed on studentā??s first name. The details of all those students having same name as in given in searching criterion will be displayed
SWING
SWING  A JAVA CODE OF MOVING TRAIN IN SWING
swing
swing  How to make swing component auto-resizable when JFrame resize
java program for Denial of Service (DoS) attacks detection - Swing AWT
java program for Denial of Service (DoS) attacks detection  i want a simple program to generate and detect a Denial of Service (DoS) attacks. using java program
Writing Calculator Program in Swing
Writing Calculator Program in Swing   ... illustrates you how to a create calculator in Swing with the source code and screen shot. For developing a small calculator program in swing we need two different
Swing
Swing  Hi, I need a program to read text from a text file to Jframe directly without browsing. Thank u   Please visit the following link: Extract file data to JTable
Java swing
Java swing  Write a java swing program to calculate the age from given date of birth
Java - Swing AWT
Java  write a swing program to display the contents of a database in a JTable
swing-awt - Swing AWT
swing-awt  Hi, Thanks for replying to my question...I'm getting some confusion to add action events in my application(Rich Text Editor).How to add action events? Thank U
java swing - Swing AWT
java swing  how i can insert multiple cive me exampleolumn and row in one JList in swing?plz g  Hi Friend, Please clarify your question. Thanks
Advertisements
 

 

 

DMCA.com