Created
March 17, 2015 11:10
-
-
Save esibirtseva/52340406eb834402f093 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package alena.s21; | |
/** | |
* Created by Алена on 17.03.2015. | |
*/ | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.io.IOException; | |
import java.net.Socket; | |
/** | |
*/ | |
public class WorkerRunnable implements Runnable{ | |
protected Socket clientSocket = null; | |
protected String serverText = null; | |
public WorkerRunnable(Socket clientSocket, String serverText) { | |
this.clientSocket = clientSocket; | |
this.serverText = serverText; | |
} | |
public void run() { | |
try { | |
InputStream input = clientSocket.getInputStream(); | |
OutputStream output = clientSocket.getOutputStream(); | |
long time = System.currentTimeMillis(); | |
output.write(("HTTP/1.1 200 OK\n\nWorkerRunnable: " + | |
this.serverText + " - " + | |
time + | |
"").getBytes()); | |
output.close(); | |
input.close(); | |
System.out.println("Request processed: " + time); | |
} catch (IOException e) { | |
//report exception somewhere. | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment