Part Number:CC3100MOD
Hello
I checked the Programmers Guide for the CC3100MOD but could not find any information about HTTPS Client connections.
I copied the HTTP Example from the recent SDK and modified it to use a TLS connection.
The current issue is that i always get the error code HTTPCli_ECONNECTFAIL during HTTPCli_connect().
When i use "curl" from my computer to deliver a POST, all works steamlessly.
Example: curl -X POST -H "Content-Type: application/octet-stream" --insecure --data-binary @REQUEST-FILE 192.168.1.20:1234/mymessage
To be clear here: I want to use the HTTPS servers self signed certificate for encryption, and i do NOT want, that the wifi module tries to validate that.
My suspicion is that this is happening, which, of course will fail.
Is there any more information i can extract, what is failing exaclty, because HTTPCli_ECONNECTFAIL is not really a lot of information.
int32_t http_server_connect(
char const * hostname, /* e.g. httpbin.org or 192.168.1.50 */
uint32_t const hostport) /* e.g. 80 */
{
int32_t ret = -1;
SlSockAddrIn_t addr;
uint32_t destinationIp;
assert( hostname );
assert( hostport );
log_internal("http_server_connect()\n");
log_internal(" HN: %s\n", hostname);
log_internal(" HP: %lu\n", hostport);
/* Resolve HOST NAME/IP */
ret = sl_NetAppDnsGetHostByName(
reinterpret_cast<signed char const*>(hostname),
rt_strlen(hostname),
&destinationIp,
SL_AF_INET);
if(ret < 0)
{
log_internal("Device couldn't get the IP for the host-name\n");
ASSERT_ON_ERROR_WITH_SL_STOP(ret);
}
/* Set up the input parameters for HTTP Connection */
addr.sin_family = SL_AF_INET;
addr.sin_port = sl_Htons(hostport);
addr.sin_addr.s_addr = sl_Htonl(destinationIp);
/* HTTPCli open call: handle, address params only */
HTTPCli_construct(&_sl_httpcli_cli);
// NO ISSUES UNTIL HERE
// HERE, I GET -102 ERROR CODE BACK
ret = HTTPCli_connect( // -102 > HTTPCli_ECONNECTFAIL
&_sl_httpcli_cli,
reinterpret_cast<SlSockAddr_t*>(&addr),
HTTPCli_TYPE_TLS,
nullptr);
if(ret < 0)
{
log_internal("Connection to server failed\n");
#warning "DEBUG"
while(1);
ASSERT_ON_ERROR_WITH_SL_STOP(ret);
}
log_internal("Successfully connected to the server\n");
return SUCCESS;
}