Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String createAliveMessage() {
        /*
        NOTIFY * HTTP/1.1
        HOST: 239.255.255.250:1900
        NT: urn:schemas-upnp-org:service:ContentDirectory:1
        NTS: ssdp:alive
        LOCATION: http://142.225.35.55:5001/description/fetch
        USN: uuid:9dcf6222-fc4b-33eb-bf49-e54643b4f416::urn:schemas-upnp-org:service:ContentDirectory:1
        CACHE-CONTROL: max-age=1800
        SERVER: Windows_XP-x86-5.1, UPnP/1.0, PMS/1.11
         */
        StringBuffer sb = new StringBuffer();

        sb.append("NOTIFY * HTTP/1.1").append("\n");
        sb.append("HOST: 239.255.255.250:1900").append("\n");
        sb.append("NT: urn:schemas-upnp-org:service:ContentDirectory:1").append("\n");
        sb.append("NTS: ssdp:alive").append("\n");
        sb.append("LOCATION: http://142.225.35.55:5001/description/fetch").append("\n");
        sb.append("USN: uuid:9dcf6222-fc4b-33eb-bf49-e54643b4f416::urn:schemas-upnp-org:service:ContentDirectory:1")
                .append("\n");
        sb.append("CACHE-CONTROL: max-age=1800").append("\n");
        sb.append("SERVER: Windows_XP-x86-5.1, UPnP/1.0, PMS/1.11").append("\n");

        return sb.toString();
    }
}