<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57553/http-send-errno--1163019603</link><description>Dear Community; 
 
 I am using this code provided by a Nordic engineer to make some HTTP request in order to use Telegram Bot API . It works fine but after 1-2 days working I am getting an error at this part of the code: 
 
 
 
 This is the error: &amp;quot;send</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Feb 2020 10:11:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57553/http-send-errno--1163019603" /><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/235392?ContentTypeID=1</link><pubDate>Thu, 20 Feb 2020 10:11:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:586944fe-0fca-41c7-8024-e52321adb5a5</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;You can&amp;#39;t turn the modem on and off more than once every other minute. Try a longer k_sleep() interval.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/234978?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 15:22:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8bef982-09e2-496f-9256-a563a771cb00</guid><dc:creator>isurki</dc:creator><description>&lt;p&gt;We have tried with 3 different Hologram SIMs and does not work. We have also verified that the problem is not the SIM, because we have successfully sent a Telegram message using a Raspberry+IOT modem + Hologram SIM.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/234693?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2020 14:47:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c436d52c-b374-47fb-9fdc-8282b9e657f0</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;What if you change SIM?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/234265?ContentTypeID=1</link><pubDate>Thu, 13 Feb 2020 17:24:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:402357ff-062c-4d59-a0e9-e697b3319253</guid><dc:creator>isurki</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;One week ago Telegram Bot API updated the minimum TLS version to 1.2. For the code you gave me, I understand that I am using 1.2v TLS version, so should work fine:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre class="aLF-aPX-K0-aPE"&gt;int &lt;em&gt;client_fd&lt;/em&gt; = socket(AF_INET, SOCK_STREAM, IPPROTO_TLS_1_2);&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can anyone confirm that the version of TLS is 1.2?&lt;/p&gt;
&lt;p&gt;However, do you have any intention to include TLS 1.3v that was released in 2018? &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks a lot.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre class="aLF-aPX-K0-aPE"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/234013?ContentTypeID=1</link><pubDate>Wed, 12 Feb 2020 14:26:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce69fe83-aa97-4afc-8025-c7350d0d7fe7</guid><dc:creator>isurki</dc:creator><description>&lt;p&gt;No, it does not work any more. I have tried to reset the device and also to re-upload the merged.hex but nothing has changed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/234001?ContentTypeID=1</link><pubDate>Wed, 12 Feb 2020 13:55:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7c864df-3a8d-40f7-bda7-07a6623d963d</guid><dc:creator>Hakon</dc:creator><description>[quote user=""]It works fine but after 1-2 days working I am getting an error at this part of the code:[/quote]
&lt;p&gt;&amp;nbsp;Does it work again after you reset the device?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/233964?ContentTypeID=1</link><pubDate>Wed, 12 Feb 2020 12:56:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3f25edc-fb3f-4a73-9ce8-d91218517c08</guid><dc:creator>isurki</dc:creator><description>&lt;p&gt;I always close the project and the Segger Studio before applying any change to prj.conf and clean build directory.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Concerning to Errno 22, that means Invalid Argument, I can&amp;#39;t understand why it fails because it worked fine for 1-2 days.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I will wait for a Nordic Engineer answer or to someone that tests my code.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/233833?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2020 18:58:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32ca6a13-fed5-4512-9d2f-c0038bcc828b</guid><dc:creator>CWallach</dc:creator><description>&lt;p&gt;Some error codes are in the file errno.h,&amp;nbsp; &amp;nbsp;errno = 22 is&amp;nbsp;EINVAL, or&amp;nbsp;Invalid argument.&lt;/p&gt;
&lt;p&gt;After editing prj.conf you have to close the project in Segger, then delete the build directory, then import the project again.&amp;nbsp; The reason is that when a project is imported prj.conf is read in order to generate other files.&amp;nbsp; If&amp;nbsp; deleting the build directory and re-importing the project is not done then changes to prj.conf&amp;nbsp; will not take affect, This is a bug in the build procedure.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/233831?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2020 18:30:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5da6c792-15d7-42ec-b146-3957e203bd77</guid><dc:creator>isurki</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*
 * Copyright (c) 2019 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
 */

#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;net/socket.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;drivers/uart.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;lte_lc.h&amp;gt;

/*#define HTTP_HOST &amp;quot;google.com&amp;quot;*/
#define HTTP_HOST &amp;quot;api.telegram.org&amp;quot;
#define HTTP_PORT 443
#define RECV_BUF_SIZE 8192

char recv_buf[RECV_BUF_SIZE + 1];

void app_http_start(void)
{
	struct sockaddr_in local_addr;
	struct addrinfo *res;
	struct addrinfo hints;

	hints.ai_flags = 0;
	hints.ai_family = AF_INET;
	hints.ai_socktype = SOCK_STREAM;
	hints.ai_protocol = 0;

	local_addr.sin_family = AF_INET;
	local_addr.sin_port = htons(HTTP_PORT);
	local_addr.sin_addr.s_addr = 0;

	printk(&amp;quot;HTTP example\n\r&amp;quot;);

	int err = getaddrinfo(HTTP_HOST, NULL, &amp;amp;hints, &amp;amp;res);
	if (err) {
		printk(&amp;quot;getaddrinfo errno %d\n&amp;quot;, errno);
		/* No clean up needed, just return */
		return;
	}

	((struct sockaddr_in *)res-&amp;gt;ai_addr)-&amp;gt;sin_port = htons(HTTP_PORT);

	char send_buf[] =
		&amp;quot;GET /bot669648316:AAEFvydDWp1fSMbUrx00bBv-9dZptEfu3gU/sendMessage?chat_id=418166911&amp;amp;text=Test HTTP/1.1\r\n&amp;quot;
		&amp;quot;Host: api.telegram.org\r\n&amp;quot;
		&amp;quot;Connection: close\r\n\r\n&amp;quot;;

	/*char send_buf[] =
		&amp;quot;GET / HTTP/1.1\r\n&amp;quot;
		&amp;quot;Host: www.google.com:443\r\n&amp;quot;
		&amp;quot;Connection: close\r\n\r\n&amp;quot;;*/

	int send_data_len = strlen(send_buf);

	int client_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TLS_1_2);

	enum {
		NONE = 0,
		OPTIONAL = 1,
		REQUIRED = 2,
	};

	int verify = OPTIONAL;

	err = setsockopt(client_fd, SOL_TLS, TLS_PEER_VERIFY, &amp;amp;verify,
			 sizeof(verify));
	if (err) {
		printk(&amp;quot;setsockopt err: %d\n&amp;quot;, errno);
	}

	err = connect(client_fd, (struct sockaddr *)res-&amp;gt;ai_addr,
		      sizeof(struct sockaddr_in));
	if (err &amp;gt; 0) {
		printk(&amp;quot;connect err: %d\n&amp;quot;, errno);
		goto clean_up;
	}

	int num_bytes = send(client_fd, send_buf, send_data_len, 0);
	if (num_bytes &amp;lt; 0) {
		printk(&amp;quot;send errno: %d\n&amp;quot;, errno);
		goto clean_up;
	}

	int tot_num_bytes = 0;

	do {
		/* TODO: make a proper timeout *
		 * Current solution will just hang 
		 * until remote side closes connection */
		num_bytes = recv(client_fd, recv_buf, RECV_BUF_SIZE, 0);
		tot_num_bytes += num_bytes;

		if (num_bytes &amp;lt;= 0) {
			printk(&amp;quot;\nrecv errno: %d\n&amp;quot;, errno);
			break;
		}
		printk(&amp;quot;%s&amp;quot;, recv_buf);
	} while (num_bytes &amp;gt; 0);

	printk(&amp;quot;\n\rFinished. Closing socket&amp;quot;);
clean_up:
	freeaddrinfo(res);
	err = close(client_fd);
}

static void modem_configure(void)
{
	if (IS_ENABLED(CONFIG_LTE_AUTO_INIT_AND_CONNECT)) {
		/* Do nothing, modem is already turned on and connected. */
	} else {
		int err;

		printk(&amp;quot;Establishing LTE link (this may take some time) ...\n&amp;quot;);
		err = lte_lc_init_and_connect();
		__ASSERT(err == 0, &amp;quot;LTE link could not be established.&amp;quot;);
		printk(&amp;quot;LTE connection established.\n&amp;quot;);
	}
}

int main(void)
{

	int err1;

	while (1){

	    printf(&amp;quot;\nStarting HTTPS test.\n&amp;quot;);
	    modem_configure();
            k_sleep(1000);
	    app_http_start();

	    if ( (err1 = lte_lc_offline() ) ){

	      printk( &amp;quot;Failure turning off Modem: %d\n&amp;quot;, err1 );

	    }

	    else{


	      printk(&amp;quot;Modem turned off.\n&amp;quot;);

	    }

	    k_sleep(1000);

	}
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Hello;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have made some test with the NRF9160 DK:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have updated to v2.1.99-ncs1-rc1 from v1.4.99 I think. After that &amp;quot;-1163019603&amp;quot; Errno disappeared and now I get &amp;quot;22&amp;quot; errno. The only change I have needed to make is to comment &amp;quot;#CONFIG_NET_RAW_MODE=y&amp;quot; line in prj.conf.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Do we know what does errno &amp;quot;22&amp;quot; mean?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I will attach here my code to send a Telegram message. Can anyone try to run it? It is not necessary to make any change. If so, the code should send a message to my telegram account.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your support.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/233822?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2020 17:10:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c752772e-a700-47ae-931e-06dc5f70f361</guid><dc:creator>CWallach</dc:creator><description>&lt;p&gt;I don&amp;#39;t know what that error code means, but&amp;nbsp; &lt;span&gt;-1163019603&amp;nbsp;&lt;/span&gt;in hex is&amp;nbsp;&amp;nbsp;FFFF FFFF BAAD BAAD‬ which looks like a generic error message.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/233806?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2020 15:16:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31ed58a9-208d-4cd7-af8c-36ead2907f6b</guid><dc:creator>isurki</dc:creator><description>&lt;p&gt;Hi;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;My program checks if the Telegram Bot has any receiving message. If so, the program replies to that message and then disconnects LTE connection. It repeats the process over and over again. So it does not send a lot of messages,&amp;nbsp; but it is checking every minute if it has messages. The process is:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;1.-Establish LTE connection. (modem_configure())&lt;/p&gt;
&lt;p&gt;2.-Check for messages.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.1.-Reply for messages&lt;/p&gt;
&lt;p&gt;3.-Disconnect LTE. (lte_lc_offline())&lt;/p&gt;
&lt;p&gt;4.-Sleep 1 minute.&lt;/p&gt;
&lt;p&gt;It would be nice to know that does &amp;quot;-1163019603&amp;quot; errno mean.&lt;/p&gt;
&lt;p&gt;I have also reflashed lastest modem firmware but nothing changed.&lt;/p&gt;
&lt;p&gt;I have also try to make an HTTP request for &lt;a href="https://ifttt.com/"&gt;IFTTT&lt;/a&gt; service and works fine.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/233801?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2020 15:01:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37f89e51-5b34-4618-9264-ecd0483412f9</guid><dc:creator>isurki</dc:creator><description>&lt;p&gt;Hi;&lt;/p&gt;
&lt;p&gt;I am using Hologram IoT SIM.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/233766?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2020 13:39:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8c84d30-0ebc-4532-b704-182c811c39bb</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Are you by any chance using an iBasis SIM?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/233610?ContentTypeID=1</link><pubDate>Mon, 10 Feb 2020 19:22:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f5920c6-237f-4c56-8b31-13b27807373e</guid><dc:creator>CWallach</dc:creator><description>&lt;p&gt;How many messages do you send until it starts to fail?&lt;/p&gt;
&lt;p&gt;I found that repeated HTTP messages would start failing and modem firmware get into a permanent failure state.&amp;nbsp; Then I added&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lte_lc_offline();&lt;/p&gt;
&lt;p&gt;after each message and its been stable.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/233604?ContentTypeID=1</link><pubDate>Mon, 10 Feb 2020 17:16:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddd49475-deaa-443c-8d76-42e2b92376f2</guid><dc:creator>isurki</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Please I need some help, something to try. Any help or idea is welcomed.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTP send errno -1163019603</title><link>https://devzone.nordicsemi.com/thread/233369?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2020 17:55:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f03390f-c299-46a4-9060-f9f577bb6fa5</guid><dc:creator>isurki</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know if it is related, but the NFR9160 is connecting to LTE, checking if there are Telegram messages, disconnecting from LTE and entering in low consumption mode over and over again. Maybe I have reached some limit.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Or maybe something got corrupted and I need to perform a factory reset...&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>