How to send a GET request from a coap server to a device running outside of local network?

1.5k views Asked by At

We have a device running inside of a local network, And a californium server is running on a separate machine outside of the network. the sever IP is public Ip. the requirement is that when server recieves a request from the device , the server should respond with a GET request to the device . The problem we are facing here is - when the device sends a request to the server, the server could not see the internal ip of the device ,the server only able to see the external IP of the device(Public IP of the network ). So the server is capturing the IP and PORT numbers from the request and creating a seperate get request, setting up the IP and port to it and sending the request to the device. the request only reaching the Public IP of the network and could not reach the device. Is there any way that the server can be able to send the GET request to the device instead of sending the message to the public IP?

One more thing is when the server is sending the piggy backed response to the device , the response is reached to the device instead of blocked at the Public IP of the device. I'm, sending the piggyback response to the device using following code:

handleGET(CoapExchange exchange){
    exchange.respond("");   //respnoding with empty payload

}

Thanks In advance ...

1

There are 1 answers

0
Julien Vermillard On BEST ANSWER

This should work if you send the message back to the client in less than 30sec. It's what we do with leshan http://github.com/eclipse/leshan . It's using Californium for implementing Lightweight M2M and it's working alike what you are trying to achieve.