im currnetly working on my thesis concerning UPnP. I had some problems with cooperation of CyberGarage's and SuperBonbonIndustries' (www.sbbi.net) implementation of UPnP in case of eventing with your example of a UPnP clock.
After receiving an event subscription it seems your UPnP implementation is expecting an answer on it's HTTP 200 OK message. Since even the subscriber set "Connection: close" it is not closed (only the HTPThread does not keep on reading). I tried to fix this by changing in class HTTPRequest in method
public HTTPResponse post(String host, int port, boolean isKeepAlive)
the lines
in = postSocket.getInputStream();
httpRes.set(in, isHeaderRequest);
to
in = postSocket.getInputStream();
// httpRes.set(in, isHeaderRequest);
and in Class Device in method
private void deviceEventNewSubscriptionRecieved(Service service, SubscriptionRequest subReq)
i added the lines
try {
subReq.getSocket().getSocket().close();
} catch (IOException e1) {
e1.printStackTrace();
}
I know, it's not a real clean solution but it works with a small change in code of SBBI.
Another point a would like be be noticed is the ssdp:alive message. Your clock device only sends 3 ssdp:alive messages but should be 4. "UPnP Device Architecture 1.0" on page 13:
"Three discovery messages for the root device."
"Two discovery messages for each embedded device."
"Once for each service type in each device."
So it should be 4 in case of the clock.
Tonight I will post a proposal in SBBI's forum to change their code in two lines to get their UPnPLib working with CyberGarage.
I even think of a kind of apache-commons-like wrapper-api to capsulate CyberGarage and SBBI in one API. I think I'll get it done the next three month.
Greetings from rainy frosty Germany!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Guy,
I had similar trouble regarding the Connection: Keep-Alive and Connection: Close, my trouble was realted to the fact that if Keep-Alive was present the Content-Length header was missing and even if IMHO RFC is not clear if it's permitted or not must of the software had trouble with that beahavior.
Stefano "Kismet" Lenzi
P.S.:SBBI software will be open source? And your Wrapper?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Your question "SBBI software will be open source?":
As far as I know it is (present) under "The Apache Software License, Version 1.1". But don't get me wrong, I just use that software, im no author.
Wrapper:
OpenSource? I think so. But it will take a few month...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear Satoshi Konno,
im currnetly working on my thesis concerning UPnP. I had some problems with cooperation of CyberGarage's and SuperBonbonIndustries' (www.sbbi.net) implementation of UPnP in case of eventing with your example of a UPnP clock.
After receiving an event subscription it seems your UPnP implementation is expecting an answer on it's HTTP 200 OK message. Since even the subscriber set "Connection: close" it is not closed (only the HTPThread does not keep on reading). I tried to fix this by changing in class HTTPRequest in method
public HTTPResponse post(String host, int port, boolean isKeepAlive)
the lines
in = postSocket.getInputStream();
httpRes.set(in, isHeaderRequest);
to
in = postSocket.getInputStream();
// httpRes.set(in, isHeaderRequest);
and in Class Device in method
private void deviceEventNewSubscriptionRecieved(Service service, SubscriptionRequest subReq)
i added the lines
try {
subReq.getSocket().getSocket().close();
} catch (IOException e1) {
e1.printStackTrace();
}
I know, it's not a real clean solution but it works with a small change in code of SBBI.
Another point a would like be be noticed is the ssdp:alive message. Your clock device only sends 3 ssdp:alive messages but should be 4. "UPnP Device Architecture 1.0" on page 13:
"Three discovery messages for the root device."
"Two discovery messages for each embedded device."
"Once for each service type in each device."
So it should be 4 in case of the clock.
Tonight I will post a proposal in SBBI's forum to change their code in two lines to get their UPnPLib working with CyberGarage.
I even think of a kind of apache-commons-like wrapper-api to capsulate CyberGarage and SBBI in one API. I think I'll get it done the next three month.
Greetings from rainy frosty Germany!
Hi Guy,
I had similar trouble regarding the Connection: Keep-Alive and Connection: Close, my trouble was realted to the fact that if Keep-Alive was present the Content-Length header was missing and even if IMHO RFC is not clear if it's permitted or not must of the software had trouble with that beahavior.
Stefano "Kismet" Lenzi
P.S.:SBBI software will be open source? And your Wrapper?
Your question "SBBI software will be open source?":
As far as I know it is (present) under "The Apache Software License, Version 1.1". But don't get me wrong, I just use that software, im no author.
Wrapper:
OpenSource? I think so. But it will take a few month...