Changed SSDPClient to use multicast and listen to the network

This commit is contained in:
Ziver Koc 2016-05-31 16:55:08 +02:00
parent 868364a0ca
commit 37c1809a61
7 changed files with 120 additions and 59 deletions

View file

@ -87,11 +87,13 @@ public class HttpHeaderParser {
protected static void parseStatusLine(HttpHeader header, String line){
// Server Response
if( line.startsWith("HTTP/") ){
header.setIsRequest(false);
header.setHTTPVersion( Float.parseFloat( line.substring( 5 , 8)));
header.setHTTPCode( Integer.parseInt( line.substring( 9, 12 )));
}
// Client Request
else if(line.contains("HTTP/")){
header.setIsRequest(true);
header.setRequestType( line.substring(0, line.indexOf(" ")));
header.setHTTPVersion( Float.parseFloat( line.substring(line.lastIndexOf("HTTP/")+5 , line.length()).trim()));
line = (line.substring(header.getRequestType().length()+1, line.lastIndexOf("HTTP/")));