Skip to content

Instantly share code, notes, and snippets.

@svkrclg
Last active December 18, 2021 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svkrclg/77a3cafa2726076a7f6fdbe7bb7220b6 to your computer and use it in GitHub Desktop.
Save svkrclg/77a3cafa2726076a7f6fdbe7bb7220b6 to your computer and use it in GitHub Desktop.
Parse Get endpoint
socket = server.accept();
System.out.println("Client accepted");
DataInputStream in = new DataInputStream(new BufferedInputStream(socket.getInputStream()));
byte[] messageByte = new byte[1000];
String dataString = "";
while(true)
{
int bytesRead = in.read(messageByte);
dataString += new String(messageByte, 0, bytesRead);
if (dataString.endsWith("\r\n\r\n"))
{
break;
}
}
System.out.println(dataString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment