1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import java.io.*;
- import java.net.Socket;
- import java.net.ServerSocket;
- public class server
- {
- public static void main(String arg[])throws IOException
- {
- try
- {
- Socket sock;
- ServerSocket sockserve;
- BufferedReader br;
- BufferedReader x;
- InputStream in;
- OutputStream out;
- PrintStream pr;
- String str;
-
- sockserve=new ServerSocket(3336);
-
- x=new BufferedReader(new InputStreamReader(System.in));
- sock=sockserve.accept();
- in=sock.getInputStream();
- out=sock.getOutputStream();
- br=new BufferedReader(new InputStreamReader(in));
- pr=new PrintStream(out,true);
- while(true)
- {
- str=x.readLine();
- System.out.println(""+str);
- pr.println(str);
- System.out.println("From client"+br.readLine());
- }
- }
- catch(Exception e)
- {
- System.out.println(""+e);
- }
- }
- }
|