Hi, i wrote this code, but when i connect via telnet, the server gives me no response :/ Please help ?
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Jenda
*/
public class Server extends Thread { Socket s; public static void main(String[] args) { try { ServerSocket ss = new ServerSocket(5222); while (true) { Socket s = ss.accept(); Server srv = new Server(); srv.s = s; srv.start(); } } catch (IOException ex) { Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); } } public void run(Socket s) { try { InputStream is = s.getInputStream(); //ze site OutputStream os = s.getOutputStream(); // to co ja posilam do site BufferedReader br = new BufferedReader(new InputStreamReader(is)); //obaleni buffered abych mohl cist po celych radcich String str; while ((str = br.readLine()) != null) { System.out.println(">> " + str); str = "SRV: " + str + "\n"; os.write(str.getBytes()); } } catch (IOException ex) { Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); } } }