We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I use TCPNet for my ethernet connection. I have a buffer wich I pass through via the function tcp_send, when I change the values of this buffer right after I called the function, then I receive the new values instead of the original ones. I change the values to show what I have sent on my display, so I add 48 with my original byte.
It's not always that this new value is being sent but around 1/10 to 1/100 times that the new value is sent.
Could it be that this function activates some sort of new thread wich operates next to mine???
Here's some of my code:
Eth_TapTeller_Frame = (ETH_TAPTELLER_FRAME *) tcp_get_buf(sizeof(ETH_TAPTELLER_FRAME)); Eth_TapTeller_Frame->Header.Versie = 1; ... tcp_send (tcp_soc, (U8 *)Eth_TapTeller_Frame, 19); P_Tekst = (U8 *)Eth_TapTeller_Frame; for (y=0;y<19;y++){ *(U8*)P_Tekst++ +=48; } *P_Tekst=0; //end of string toevoegen LCD_gotoxy(1,4); LCD_puts((U8 *)Eth_TapTeller_Frame);
Anyone got an idea???
Hi Karel,
I suspect your tcp_send() function is not copying the contents of the supplied buffer, but just its address. It will transmit it when it can. Meanwhile, if you change the contents BEFORE it is transmitted, then it is the CHANGED contents that are sent. Make a temporary copy of your buffer before calling tcp_send() and display that instead of the actual buffer.
David.
But my function returns __TRUE when sending was succesfull. So this would mean that the function operates immediatly, or will not return untill it is succesfull??
So if it isn't succesfull it will not send anything in the function... So how could it then send when it has returned from the function. Then their return value isn't placed on the right spot, i think?
Send operations normally only report that the TCP stack has accepted data for transmission, and that the connection is still believed to work. It isn't until you close the connection - or sometimes later on future send() commands that you get any feedback about errors.
Networks are slow. If TCP/IP was implemented so that the sender gets a full-transfer result for every send, then applications would in some situations manage less than one send()/s.
The function tcp_send() sends the packet and releases the memory. So you can not use it anymore after the packet has been sent.
Franc