Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Lab10;
- import java.io.*;
- import java.net.*;
- public class EchoServer {
- static final int PORT = 6666;
- public static void main(String args[]) {
- ServerSocket serverSocket = null;
- Socket socket = null;
- try {
- serverSocket = new ServerSocket(PORT);
- } catch (IOException e) {
- e.printStackTrace();
- }
- while (true) {
- try {
- socket = serverSocket.accept();
- } catch (IOException e) {
- System.out.println("I/O error: " + e);
- }
- // new thread for a client
- new ServerThread(socket).start();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement