Last active
December 19, 2021 17:27
-
-
Save svkrclg/9b70417bb89941d0304c774f79977a34 to your computer and use it in GitHub Desktop.
POST read and send response
This file contains hidden or 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
String dataString = ""; | |
String body = ""; | |
try | |
{ | |
while(true) | |
{ | |
int bytesRead = in.read(messageByte); | |
if (bytesRead == -1) | |
break; | |
dataString += new String(messageByte, 0, bytesRead); | |
String[] results = processData(dataString); | |
if (results[0].equals("true")) | |
{ | |
body = results[1]; | |
break; | |
} | |
} | |
String message = "HTTP/1.1 200 OK\r\n" + | |
"Server: noob-server\r\n" + | |
"Date: 14 March, 1977\r\n" + | |
"\r\n" + | |
"Received : " + body ; | |
out.write(message.getBytes()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment