khaled4github / jcoap

Automatically exported from code.google.com/p/jcoap
0 stars 0 forks source link

How Can I transform HTTP to CoAP by the Proxy? #12

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I run the coapClient and Proxy on different computer
2. set the setProxyUri  as ("http://ip:port") in theBasicCoapClient.java
3. run the wireshark,but the Proxy send a TCP package but not HTTP

What is the expected output? What do you see instead?
I want to transform HTTP to CoAP, I send a coap message to Proxy and it 
transform it to CoAP 

What version of the product are you using? On what operating system?
mac os x

Please provide any additional information below.
any document about the Proxy?

Original issue reported on code.google.com by ly...@email.biigroup.com on 18 Oct 2012 at 7:47

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
It works with in the following scenarios:

From BasicCoapClient (COAP requests to HTTP resources):
   1) SERVER_ADDRESS set to the IP of the host running org.ws4d.coap.server.Proxy
   2) For coap-coap, use coapRequest.setProxyUri("coap:<ip_endpoint>/resource")
      - e.g ip_endpoint set to IP of host running BasicCoapServer
   3) For coap-http, use coapRequest.setProxyUri("http:<ip_endpoint>/resource")
      - N.B you need an HTTP server running at ip_endpoint

From Browser (HTTP requests to COAP resources):
   1) Setup a HTTP proxy using IP of the host running org.ws4d.coap.server.Proxy, port 8080
   2) Insert in the address bar the IP of the endpoint (e.g BasicCoapServer)

I deleted two useless comments. I hope this will help.

Original comment by fmletti...@gmail.com on 24 Mar 2015 at 11:18

GoogleCodeExporter commented 8 years ago
I am still unsure how from the browser works.   I was going through the code 
and it looks like its just replacing the schema with coap;// and requesting a 
resource from it self.  How is the forwarding address passed? On Californium, 
its passed in the path like 
http://localhost:8080/proxy/coap://localhost:PORT/target

Original comment by Alexande...@gmail.com on 25 Mar 2015 at 5:22

GoogleCodeExporter commented 8 years ago
If you setup the proxy as I said you can just do an http GET and you will get 
the translated CoAP resource (e.g http://127.0.0.1:5684/statistic is the one 
run by default in Proxy.java). No need for additional parameters

Original comment by fmletti...@gmail.com on 17 Apr 2015 at 1:37