Package cleancoderscom.socketserver

Examples of cleancoderscom.socketserver.SocketServer.start()


        s.getOutputStream().write(response.getBytes());
      } catch(IOException e) {
        e.printStackTrace();
      }
    });
    server.start();
  }

  private static String makeResponse(String content) {
    return "HTTP/1.1 200 OK\n" +
        "Content-Length: " + content.length() + "\n" +
View Full Code Here


import java.net.Socket;

public class HelloWorld implements SocketService {
  public static void main(String[] args) throws Exception {
    SocketServer server = new SocketServer(8080, new HelloWorld());
    server.start();
  }

  @Override
  public void serve(Socket s) {
    try {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.