Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

connection refused

ping pong
2010-03-29
2013-05-02
  • ping pong
    ping pong
    2010-03-29

    First of all thank you Mr.Satoshi for providing this library.
    I am trying to run the sample code that is provided in the package.
    I build the samples for Clock and Tv from eclipse environment.
    I tried running Clock and Tv samples but Control Point in Tv is never able to connect to clock. I am not able to understand why I am getting connection refused (please see stack below).
    I think that Tv is able to get the device description of clock from it is not able to subscribe to the events.

    Please let me know how to solve this issue.

    Here's the call stack.
    CyberGarage warning : Connection refused: connect
    java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at org.cybergarage.http.HTTPRequest.post(HTTPRequest.java:404)
    at org.cybergarage.http.HTTPRequest.post(HTTPRequest.java:471)
    at org.cybergarage.upnp.event.SubscriptionRequest.post(SubscriptionRequest.java:218)
    at org.cybergarage.upnp.ControlPoint.subscribe(ControlPoint.java:651)
    at org.cybergarage.upnp.ControlPoint.subscribe(ControlPoint.java:664)
    at TvDevice.subscribeService(TvDevice.java:214)
    at TvDevice.checkNewDevices(TvDevice.java:223)
    at TvDevice.deviceNotifyReceived(TvDevice.java:244)
    at org.cybergarage.upnp.ControlPoint.performNotifyListener(ControlPoint.java:424)
    at org.cybergarage.upnp.ControlPoint.notifyReceived(ControlPoint.java:512)
    at org.cybergarage.upnp.ssdp.SSDPNotifySocket.run(SSDPNotifySocket.java:138)

     
  • ping pong
    ping pong
    2010-03-29

    Adding more info to prev post.
    I am always getting following error on Clock side.

    java.net.SocketException: Connection reset by peer: socket write error

    HTTPSocket.post(HTTPResponse, byte, long, long, boolean) line: 192
    HTTPSocket.post(HTTPResponse, long, long, boolean) line: 261
    HTTPRequest.post(HTTPResponse) line: 379
    ClockDevice(Device).httpGetRequestRecieved(HTTPRequest) line: 1666
    ClockDevice(Device).httpRequestRecieved(HTTPRequest) line: 1598
    ClockDevice.httpRequestRecieved(HTTPRequest) line: 188
    HTTPServer.performRequestListener(HTTPRequest) line: 212
    HTTPServerThread.run() line: 48

     
  • Satoshi Konno
    Satoshi Konno
    2010-04-02

    Hi,

    Recently, I don't check the sample program so much X-<
    I will check your problem from now, please wait for a while.

    Thanks for your report.

     
  • ping pong
    ping pong
    2010-04-05

    Thank you Skonno,
    Finally I am able to get the samples to work, but I had to make following changes. Could you please verify if these are correct.

    In lot of places urlBaseStr = dev.getURLBase(); was returning url = "http://:4004"
    I added a function to check this, and if the above function fails I use urlBaseStr = rootDev.getLocation(); instead.

    private boolean isUrlValid(String url){
    if ( url.contains("http://:")){
    return false;
    }
    return true;
    }

    One more change that I had to do was in Service.java function getSCPDNode() to get the node from fileURL

    String newScpdURLStr = rootDev.getDescriptionFilePath() + HTTP.toRelativeURL(scpdURLStr);
    try {
    scpdNode = getSCPDNode(new File(newScpdURLStr));
    if (scpdNode != null) {
    data.setSCPDNode(scpdNode);
    return scpdNode;
    }
    }