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 Жыл бұрын
BOSS MAN!
@ezrakrause9343 Жыл бұрын
MY MAN!
@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.
@linassturys774610 ай бұрын
Thanks. I work with stm32f769i-disco. Couldn't get data back to client and after your fix all stated to work well.
@linassturys774610 ай бұрын
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?
@bobby95683 жыл бұрын
Sir, you are the King of the world!
@dymastro7883 жыл бұрын
Agree
@mohammadkianibeyragh51732 жыл бұрын
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?
@vovanbuong67162 жыл бұрын
Hi Sir, I see one issue here: In the tcp_server_handle(), the esTx is the NULL pointer.
@prashanttandale18072 жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
Did you find a solution?
@controllers_knowledge7 ай бұрын
how to handle the data if data is got corrupted?
@controllers_knowledge8 ай бұрын
i am getting the connection refused by the host? what could be the cause?
@rafacostantinos514310 ай бұрын
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 Жыл бұрын
hello sir in stm32f7 server want to send the data when server press the user button can u tell me how to implement
@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 Жыл бұрын
Just fill the buffer with NULL ('\0') characters
@controllers_knowledge7 ай бұрын
@@ControllersTech how to handle the data if data is got corrupted?
@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 Жыл бұрын
Connect the other computers to the same network. Then you can ping
@EasyElectronics24122 жыл бұрын
Sir where were you i was really helpless with lwip server and client 😭😭😭
@amorftor Жыл бұрын
Should I plug the card's ethernet port into the computer or the router?
@ControllersTech Жыл бұрын
Router is preferred.
@davenirkohlrausch27842 жыл бұрын
Hi How can I send one message to client without one echo message?
@ControllersTech2 жыл бұрын
Instead of sending back the echo, you can send some other message..
@gvrvenky418 Жыл бұрын
@@ControllersTech can u tell me sir how to remove the echo part and how to send the data to client
@controllers_knowledge7 ай бұрын
@@ControllersTech how to handle the data if data is got corrupted?
@fahrettinokur30033 жыл бұрын
hi, I tried your code with stm32f4 board But send "12" return 12 . what do you think i did wrong?
@Duster3932 жыл бұрын
Did you find a solution?
@vivekkumarsharma77324 ай бұрын
Did you find a solution to this ?
@coders012 жыл бұрын
What to do when we use FreeRTOS?
@ControllersTech2 жыл бұрын
Check the Playlist.. it's already covered
@coders012 жыл бұрын
@@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_harashchak2 жыл бұрын
Thanks for your great work. Really helpful video
@noobody1382 жыл бұрын
I'm grateful, thank you for your efforts. 🥰😇
@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_knowledge7 ай бұрын
how to handle the data if data is got corrupted?
@maccabita12 жыл бұрын
Thanks can you publish the full code?
@ControllersTech2 жыл бұрын
Check description..
@Ramachandran_S7 ай бұрын
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-de7np10 ай бұрын
Thank you very much, sir.
@iluhgasie2 жыл бұрын
I've got only one echo. After that the TCP freezes
@Duster3932 жыл бұрын
Did you find a solution?
@iluhgasie2 жыл бұрын
Yes
@iluhgasie2 жыл бұрын
Delete pbuf_free at the end of handle should work.
@Duster3932 жыл бұрын
@@iluhgasie Ty now its echoing my input but will not let me append or alter my input. Do you experience the same behaviour?
@sunilzode21992 жыл бұрын
@@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.pr12 жыл бұрын
Hy... I have tried this code in 439ZI. Got Ping-OK, Connected-OK, but it's stuck after one time
@Duster3932 жыл бұрын
Did you find a solution?
@kevingai3705 ай бұрын
what a clear voice
@chrislamb47232 жыл бұрын
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 Жыл бұрын
struct tcp_server_struct esTx = {0}; create a variable instead of a pointer