Problem while sending TCP packet with STM32F746NG to Raspberry Pi (ST32CubeIDE, LWIP)
Hello everyone,
What i am trying:
I am trying to send a http Request (with a TCP connection and LwIp) with my STM32F746NG controller to my Respberry PI. The Webserver on that Raspberry Pi has a RestApi. So I can send a command with the http request. I don't want to receive anything.
I am using the ST32CubeIDE, Ethernet, LWIP, freeRTOS.
How I do it:
I configured a thread to establish a TCP connection and to send my defined http Request.
void StartTestTask(void const * argument)
{
/* USER CODE BEGIN StartTestTask */
struct netconn *xNetConn = NULL;
struct netbuf *Buf = NULL;
ip_addr_t local_ip, remote_ip;
u16_t m_len;
IP_ADDR4(&remote_ip, 192, 168, 1, 20);
IP_ADDR4(&local_ip, 192, 168, 1, 220);
//char* message = "GET /fhem?cmd=set+mx_lamp+toggle HTTP/1.1\r\nHost:192.168.1.20:8088\r\n\r\n";
char *message = "test";
m_len = strlen( message );
xNetConn = netconn_new ( NETCONN_TCP );
netconn_bind ( xNetConn, &local_ip, 80 );
netconn_connect ( xNetConn, &remote_ip, 8088 );
osDelay(1000);
Buf = netbuf_new();
netbuf_alloc(Buf, 10); // 4 bytes of buffer
Buf->p->payload = message;
Buf->p->len = m_len;
netconn_write(xNetConn, Buf->p->payload, Buf->p->len, NETCONN_COPY );
vTaskDelay(100); // To see the result easily in Comm Operator
netbuf_delete(Buf);
/* Infinite loop */
for (;;) {
}
/* USER CODE END StartTestTask */
}The Problem:
On my Raspberry Pi, I can see with Wireshark, that the TCP connection is working and the package is sent to the right IP adress and Port. But the data of the package looks very strange and the web server is doing nothing.
So I think the http request is not written correctly to the TCP package.
I googled a lot but can't find any solution. Hope someone can help me.
Thank you in advance to everyone
