swing chatt program

swing chatt program

how to invoke the code from JTextArea to Socket

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 [email protected] 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 display image on ImageIcon after selecting an image from the JFileChooser
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 send message from one computer to another and what are the requirements
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
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 delete a selected record from a table
SWING
SWING  A JAVA CODE OF MOVING TRAIN IN SWING
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
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
swing
swing  How to make swing component auto-resizable when JFrame resize
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
program
program  any program of hotel or school management
program
program  program of jdbc using ms access for creating table
program
program  write a javascript program to create a application form with validation
program
program  write a html program in show table and this word in box
program
program  write a program different between to dates in terms of days in java
Java - Swing AWT
Java  write a swing program to display the contents of a database in a JTable
program
program  WAP a java program to form 1/2+3/4+5/6+7/8 series
program
program   Write a program to find the difference between sum of the squares and the square of the sums of n numbers
program
program  write a program reversee a string. input-hi this is roseindia output-roseindia is this hi
program
program  develop a servlet to insert the data in the database from our program in the table stored in the database
ModuleNotFoundError: No module named 'swing'
ModuleNotFoundError: No module named 'swing'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'swing' How to remove the ModuleNotFoundError: No module named 'swing'
program
program   An old-style movie theater has a simple profit program. Each customer pays $5 per ticket. Every performance costs the theater $20, plus $.50 per attendee. Develop the program calculateTotalProfit that consumes
program
program  write a java program to input a no. and print wheather the no. is a special no or not. (special no. are those no whose factorial of the sum of digit of the no is same as the original
program
program  Develop the program calculateCylinderArea, which accepts radius of the cylinder's base disk and its height and computes surface area of the cylinder
program
program  explanation of program on extending thread class   Hi Friend, Please go through the following link:ADS_TO_REPLACE_1 Java Threads Thanks
program
program  Develop a program that computes the distance a boat travels across a river, given the width of the river, the boat's speed perpendicular to the river, and the river's speed. Speed is distance/time, and the Pythagorean
program
program  how to improve programming skills plss tell some tips..i am understanding concepts but unable to write program so,pls give some guideness plsss
Program
Program  a program to prove that default constructor of super class is available to subclass by default. Define a parameterize constructor for super class to store name = â??Tommyâ?? age=â??23â?? and call this constructor
Program
Program  a program to create two classes Commercial and Domestic. Override the method calculatebill() of Commercial class(Rs.8 per unit) into Domestic class(Rs 6 per unit) to compute electricity bill for both classes
program
program  no i want a program that shows how merge sort algorithm works in graphical representations like numbers are taken in circles and computation... in rectangles or circles wat ever it may be. the theme of program is to show algorithm
Java Swing Tutorials
and you can use it in your program. Java Swing tutorials first gives you brief... a Frame   This program shows you how to create a frame in Java Swing... points.      Writing Calculator program in Swing
program
program  . Develop a program that accepts an initial amount of money (called the principal), a simple annual interest rate, and a number of months will compute the balance at the end of that time. Assume that no additional

Ads