STM32 ETHERNET #4. TCP SERVER

  Рет қаралды 25,130

ControllersTech

ControllersTech

Күн бұрын

Пікірлер: 63
@СергейАвдеев-м3й
@СергейАвдеев-м3й Жыл бұрын
Thanks to the author! I found a problem in that after several messages sent, the connection was interrupted and not restored. Everything was solved by fixing the function tcp_server_handle. static void tcp_server_handle (struct tcp_pcb *tpcb, struct tcp_server_struct *es) { struct tcp_server_struct *esTx; char buf[100]; strcpy(buf, es->p->payload); esTx = es; strcpy(buf,"+ Hello from TCP SERVER "); esTx->p->payload = (void *)buf; esTx->p->tot_len = strlen (buf); esTx->p->len = strlen (buf); tcp_server_send(tpcb, esTx); }
@ezrakrause9343
@ezrakrause9343 Жыл бұрын
BOSS MAN!
@ezrakrause9343
@ezrakrause9343 Жыл бұрын
MY MAN!
@ebzadeh
@ebzadeh Жыл бұрын
Thanks a lot! I am using STM32F767ZI and STM32CubeIDE. In this case I found HardFault error after calling "tcp_server_handle()". that was about memmory allocation for "struct tcp_server_struct *esTx;". I've added solved it "esTx = (struct tcp_server_struct *)mem_malloc(sizeof(struct tcp_server_struct));" before using "esTx" and solved it.
@linassturys7746
@linassturys7746 10 ай бұрын
Thanks. I work with stm32f769i-disco. Couldn't get data back to client and after your fix all stated to work well.
@linassturys7746
@linassturys7746 10 ай бұрын
in function "tcp_server_accept" is allocated dinamic variable "es = (struct tcp_server_struct *)mem_malloc(sizeof(struct tcp_server_struct));", but didn't see mem_free() on the end of function. It looks like potential memory leakage, or I am not right?
@bobby9568
@bobby9568 3 жыл бұрын
Sir, you are the King of the world!
@dymastro788
@dymastro788 3 жыл бұрын
Agree
@mohammadkianibeyragh5173
@mohammadkianibeyragh5173 2 жыл бұрын
hello sir. i implement tcp server for stm32f407vet6. and with client connect to tcp server and send data and press close connection. but this only can repeat for nine times. after nine times of connect to tcp server, i cant connect to that again and i must to reset the MCU. can you know the solution?
@vovanbuong6716
@vovanbuong6716 2 жыл бұрын
Hi Sir, I see one issue here: In the tcp_server_handle(), the esTx is the NULL pointer.
@prashanttandale1807
@prashanttandale1807 2 жыл бұрын
Hi, Thanks for such a informative video on TCP server. I am trying to implement the TCP server for stm32f4 device. I followed the same steps as given in the video. I am able to get response for ping command but I am not able to connect to TCP server. Can you help me in this? I am getting "TCP connection error :10061". Anyone facing same issue?
@PoroHard
@PoroHard Жыл бұрын
Hello Please tell me how I can transfer data after establishing a connection with the client, without a request from the client. Please provide a code example.
@amir.chavoshi
@amir.chavoshi Жыл бұрын
Hi, I have a problem with payload size. tot_len is working correctly with increase or decrease of client's packet but in every condition only 5 bytes of packet are stored in payload. Could you hep me please?
@hongquanphan5582
@hongquanphan5582 Жыл бұрын
i'm have problem when i sended hex message through hercules, the program received it however it stop read the message at 0x00 byte, i dont know why. Can you help me with this problem?
@mustafayasar893
@mustafayasar893 Жыл бұрын
Did you find a solution?
@controllers_knowledge
@controllers_knowledge 7 ай бұрын
how to handle the data if data is got corrupted?
@controllers_knowledge
@controllers_knowledge 8 ай бұрын
i am getting the connection refused by the host? what could be the cause?
@rafacostantinos5143
@rafacostantinos5143 10 ай бұрын
hello Sir, thanks for you helpful videos. I am trying your solution on nucleoh743zi2, it seems that when I call tcp_server_init() in the main code, my board stops responding, and the ping stops and it is unreachable any more. just when I comment this line (tcp_server_init()) the pinging is restored. what would be the problem? I just added the RAW files as you recommended, then changed the ip to my board's ip, and the port to 10 as you did exactly, but my board is not responding. can you give some hands please?
@venkyembedded
@venkyembedded Жыл бұрын
hello sir in stm32f7 server want to send the data when server press the user button can u tell me how to implement
@GvrVenky369
@GvrVenky369 Жыл бұрын
Hello sir after server sending data to client how to clear the buffer because sometimes client is not receiving the data with out clearing that buffer
@ControllersTech
@ControllersTech Жыл бұрын
Just fill the buffer with NULL ('\0') characters
@controllers_knowledge
@controllers_knowledge 7 ай бұрын
@@ControllersTech how to handle the data if data is got corrupted?
@amir.chavoshi
@amir.chavoshi Жыл бұрын
Hi Sir, I want to ping server with any client( other computers ). This is a problem for me and I don't know how MCU is only connecting with one computer that I runed the code on. Help me please.
@ControllersTech
@ControllersTech Жыл бұрын
Connect the other computers to the same network. Then you can ping
@EasyElectronics2412
@EasyElectronics2412 2 жыл бұрын
Sir where were you i was really helpless with lwip server and client 😭😭😭
@amorftor
@amorftor Жыл бұрын
Should I plug the card's ethernet port into the computer or the router?
@ControllersTech
@ControllersTech Жыл бұрын
Router is preferred.
@davenirkohlrausch2784
@davenirkohlrausch2784 2 жыл бұрын
Hi How can I send one message to client without one echo message?
@ControllersTech
@ControllersTech 2 жыл бұрын
Instead of sending back the echo, you can send some other message..
@gvrvenky418
@gvrvenky418 Жыл бұрын
@@ControllersTech can u tell me sir how to remove the echo part and how to send the data to client
@controllers_knowledge
@controllers_knowledge 7 ай бұрын
@@ControllersTech how to handle the data if data is got corrupted?
@fahrettinokur3003
@fahrettinokur3003 3 жыл бұрын
hi, I tried your code with stm32f4 board But send "12" return 12 . what do you think i did wrong?
@Duster393
@Duster393 2 жыл бұрын
Did you find a solution?
@vivekkumarsharma7732
@vivekkumarsharma7732 4 ай бұрын
Did you find a solution to this ?
@coders01
@coders01 2 жыл бұрын
What to do when we use FreeRTOS?
@ControllersTech
@ControllersTech 2 жыл бұрын
Check the Playlist.. it's already covered
@coders01
@coders01 2 жыл бұрын
@@ControllersTech Hello, I have seen several problems in the tcp_server_handle() function, which causes receiving from the network with errors and micro crashes. Did you manage to fix this problem? At first I thought it was because of FreeRTOS but later I realized it was because of that function.
@andrii_harashchak
@andrii_harashchak 2 жыл бұрын
Thanks for your great work. Really helpful video
@noobody138
@noobody138 2 жыл бұрын
I'm grateful, thank you for your efforts. 🥰😇
@marcometzger7719
@marcometzger7719 Жыл бұрын
Hello erveryone, with the newest CubeMX in the main function it is only "MX_LWIP_Process();" which is called. I wonder, because I have to comment out the call "pbuf_free(es->p);" line from tcp_server_handle function and don't know why. But this way all is working perfect. If the message received is longer than 100 chars the message has to be limited otherwise the program crashes.
@controllers_knowledge
@controllers_knowledge 7 ай бұрын
how to handle the data if data is got corrupted?
@maccabita1
@maccabita1 2 жыл бұрын
Thanks can you publish the full code?
@ControllersTech
@ControllersTech 2 жыл бұрын
Check description..
@Ramachandran_S
@Ramachandran_S 7 ай бұрын
hi sir, your explanation was soo... good... I am using this example in NUCLEO-F439ZI EVM, I found the problem when I sent the data above 5 character, up to 5 character it came correct, If I add 6th character and above buf come with some garbage value. for your reference my result will be " hkd34 hkd34 + Hello from TCPServer techntechn techntechnW~ŠmW~ŠmW~ŠmW~ŠmW~ŠmW~ŠmW~ŠmW~ŠmW~ŠmW~ŠmW~ŠmW~ŠmW~ŠmW~ŠmW~Šm + Hello from TCPServer". I try different types of memory allocation, but it cannot work, I don't know where I did the mistake. thank you
@DarkKnight-de7np
@DarkKnight-de7np 10 ай бұрын
Thank you very much, sir.
@iluhgasie
@iluhgasie 2 жыл бұрын
I've got only one echo. After that the TCP freezes
@Duster393
@Duster393 2 жыл бұрын
Did you find a solution?
@iluhgasie
@iluhgasie 2 жыл бұрын
Yes
@iluhgasie
@iluhgasie 2 жыл бұрын
Delete pbuf_free at the end of handle should work.
@Duster393
@Duster393 2 жыл бұрын
@@iluhgasie Ty now its echoing my input but will not let me append or alter my input. Do you experience the same behaviour?
@sunilzode2199
@sunilzode2199 2 жыл бұрын
@@Duster393 Maybe you have found solution coz its been 5 months, if not, use this code in your tcp_server_handle function. struct tcp_server_struct *esTx; char buf[100]; strcpy(buf, es->p->payload); // keep this if you want do processing on received data //like below I just set an LED on for particular data if((buf[0] == 0xAA) && (buf[1] == 0x55)) HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_SET); esTx = es; // This copies everything to your local variable strcpy(buf, "Hello from Sunil's TCP Server "); esTx->p->payload = (void*) buf; // This just changes the pointer to payload esTx->p->tot_len = strlen (buf); // This sets payload length esTx->p->len = strlen(buf); // This sets payload length tcp_server_send(tpcb, esTx);
@YouTube.pr1
@YouTube.pr1 2 жыл бұрын
Hy... I have tried this code in 439ZI. Got Ping-OK, Connected-OK, but it's stuck after one time
@Duster393
@Duster393 2 жыл бұрын
Did you find a solution?
@kevingai370
@kevingai370 5 ай бұрын
what a clear voice
@chrislamb4723
@chrislamb4723 2 жыл бұрын
Using an STM32F7-144 nucleo... upon executing line 488 (esTx->p->payload = (void *)buf;) in tcpServerRAW.c I go to HardFault_Handler in stm32f7xx_it.c . I commented out the unused "get the Remote IP" and "Extract the IP" sections to make tcp_server_handle as lean as possible ... I was able to get the app working with that change. I am not sure why that worked, but I plan investigate the TCP Protocol Control Block structure in depth for clues.
@illikkal
@illikkal Жыл бұрын
struct tcp_server_struct esTx = {0}; create a variable instead of a pointer
@controllers_knowledge
@controllers_knowledge 7 ай бұрын
how to handle the data if data is got corrupted?
STM32 UART Ring Buffer using DMA and IDLE Line
20:50
ControllersTech
Рет қаралды 23 М.
STM32 ETHERNET #5. TCP CLIENT || RAW API
10:57
ControllersTech
Рет қаралды 14 М.
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Quantum Mechanics: book recommendations
10:43
Dr. Jorge S. Diaz
Рет қаралды 5 М.
STM32 ETHERNET #1. Hardware Configuration || PART 1
19:05
ControllersTech
Рет қаралды 97 М.
STM32 ETHERNET #10 Basic HTTP SERVER || NETCONN || FREERTOS || LWIP
17:31
STM32 Ethernet Example - HTTP Server Part 1 | EmbeTronicX
11:18
EmbeTronicX
Рет қаралды 13 М.
The First Amiga Virus - Something Wonderful Has Happened
17:05
Modern Vintage Gamer
Рет қаралды 110 М.
STM32 ADC #1. How to configure ADC || Single Channel Polling Mode
13:55
ControllersTech
Рет қаралды 2,2 М.
STM32 ETHERNET #9 TCP SERVER and CLIENT || NETCONN || FREERTOS || LWIP
26:31
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН