Community news, upcoming events and general discussions
Threads: 34 Posts: 86
Get technical support from the community
Threads: 1352 Posts: 7332
Threads: 18 Posts: 64
Tell us how to make XDK better!
Threads: 35 Posts: 117
Share and discuss community member projects
Threads: 76 Posts: 337
I would like to post sensor data directly from XDK to BIC through http connector, our http connector is an application running on BIC.
It seems XDK has to translate the server domain to IP address first, and then connect using IP, the problem here is that if the server is behind load balancer, it cannot get the real IP for our application, does anyone know how to overcome this issue?
Hello Shaodong, there are different to implement a load balancer. If the load balancer is implemented via DNS then the IP address changes for each request, i assume this is the case in your application. This means the XDK would be assigned a different IP out of a pool of available IP addresses from the servers that are used to process requests each time it resolves the host. A load balancer does not prevent the XDK from sending requests to the correct IP. The host name needs to be resolved in any request, no matter which client is sending the request. Please tell me if this brings some clarity. Please feel free to go more into detail. Kind regards, Manuel
Thanks for your clarification. My case is kind of virtual hosting setup, means I always get a public IP which I think belongs to the proxy, but not the actual application (instance or container), the solution for this case is to add "Host: xxx" to http request header, however, I couldn't find a way to do it using RestClient or HttpClient. Does XDK team has a plan to support customized http header in the future?
For now I have to use Tcp to manually compose the request, by the way, do you have example code for TCP usage? I found Serval_XTcp.h in XDK API 27.0, but the example code (udp) seems using TI simplelink's socket.h. It is quite confusing. Could you give some suggestion?
Hello Gavin, the serval stack generates the http header automatically. Due to my knowledge it is currently not possible to fill the HTTP header host field with a name. I will take it on our improvement list and discuss it with the team. You do not need to access the serval stack for TCP. The XDK library socket.h and the SendDataOverUdp example provide all you need to establish a connection to the XDK via TCP. UDP works in the same way as TCP. Thus you can take the SendDataOverUdp example as starting point. Fore more information and example code please take a look at this thread. Kind regards, Manuel
Thank you for your information, and I have just implemented this workaround to send XDK data directly to Bosch IoT suite.
The approach is shared in this post.
Hello Shaodong, I am glad to help. There is one update on your query: Options to alter the http header via the serval stack are currently not planned. If you want to send customized http headers you need to access the simplelink API by TI directly like you already did in the project you posted. Please don't hesitate to ask if you have further questions. Kind regarrds, Manuel