package server1; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; public class ChatServer implements Runnable{ ServerSocket ss; Socket sc1; Socket sc2; public ChatServer(ServerSocket ss) { this.ss=ss; new Thread(this).start(); } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub } @Override public void run() { try{ while(true){ sc1=ss.accept(); sc2=ss.accept(); InputStream is2=sc2.getInputStream(); OutputStream os1=sc1.getOutputStream(); //os1.write(is2.read()); int bait=is2.read(); while(bait!=-1){ os1.write(bait); bait=is2.read(); // System.out.println(bait); } //System.out.println("ots"); } } catch(IOException ex){ //throw new RuntimeException(ex); System.out.println(ex); } } }