<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/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/"><channel><title>receive data and send date LPC2294 ARM7</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/38148/receive-data-and-send-date-lpc2294-arm7</link><description> 
Hello folks, 

 
I have made a connection between a PC and the LPC2294 with the
TCP/IP Port. I am able to send some data but if I want to receive
something from the PC I get nothing. 

 
The PC send me a string with only the number &amp;quot;1&amp;quot; in it. Then the</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: receive data and send date LPC2294 ARM7</title><link>https://community.arm.com/thread/144541?ContentTypeID=1</link><pubDate>Sun, 11 Jan 2009 03:29:09 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:bd240b41-d79b-435c-a1a4-0e253d99b016</guid><dc:creator>Hotte Meyer</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thank-you Per Westermark for your helpful tips. My program runs.
It is not beautiful from the code but for that I have now enough time
to check it and to make it better.;-)&lt;/p&gt;

&lt;p&gt;
Thx&lt;br /&gt;
Hotte&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: receive data and send date LPC2294 ARM7</title><link>https://community.arm.com/thread/142180?ContentTypeID=1</link><pubDate>Fri, 02 Jan 2009 08:21:29 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d7c7f64a-6c10-4d97-816e-a713b0550fed</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
First off, a C string of size 1 can only contain the terminating
&amp;#39;\0&amp;#39; character - so it doesn&amp;#39;t matter how many times you concatenat -
your string will not grow.&lt;/p&gt;

&lt;p&gt;
Second: You use sprintf() to convert a byte into a decimal number
in ASCII format - but the largest value that may fit in a byte is 255
- and the text buffer to take this value converted to decimal must be
at least four bytes large: &amp;#39;2&amp;#39;, &amp;#39;5&amp;#39;, &amp;#39;5&amp;#39;, &amp;#39;\0&amp;#39;. Your code will get a
buffer overflow.&lt;/p&gt;

&lt;p&gt;
Third: You never set data[10] to empty, so what start value do you
think you have when you later call strcat()? strcat() may think there
already is 1317 characters in data[] - even if data[] was only
declared to hold 10 characters including any termination.&lt;/p&gt;

&lt;p&gt;
Fourth: Concatenating 10 ASCII strings after each other, each with
up to three characters, would require a destination string that is
10*3+1 = 31 bytes large. But starting to compute exact buffer sizes
will soon end up in a buffer overflow. Your current code does
overflow the buffer.&lt;/p&gt;

&lt;p&gt;
Fifth: What happens if you concatenate two numbers in ASCII form
after each other? Let&amp;#39;s say one was the value 10 and the other was
the value 127. Then you get &amp;quot;10127&amp;quot;. How will you manage to know if
this represents 10,127 or 101,2?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: receive data and send date LPC2294 ARM7</title><link>https://community.arm.com/thread/131806?ContentTypeID=1</link><pubDate>Fri, 02 Jan 2009 05:16:55 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6213af19-aa67-471a-a073-4038fee8eff8</guid><dc:creator>Hotte Meyer</dc:creator><description>&lt;p&gt;&lt;p&gt;
Ok I have found one error in my deliberation.&lt;br /&gt;
In the function tcp_callback have I a pointer(U8 *ptr) what on show
me what is send to my MC. In the function procrec I hand over the
pointer and in the variable buf stand that was may MC receive from
the PC or is that wrong?&lt;br /&gt;
On the PC I code a programm with VB-Net to send me a string to the
MC. So I want to convert the buf into a string and search in the
string after that was the PC send. But it does not work. Have someone
an idea for that problem. Sorry about my bad english!&lt;br /&gt;
Thx&lt;br /&gt;
Hotte&lt;/p&gt;

&lt;pre&gt;
U16 tcp_callback (U8 soc, U8 evt, U8 *ptr, U16 par)
(evt) {
      case TCP_EVT_DATA:
         procrec(ptr);
         break;
         ......

void procrec (U8 *buf)
{
int i;
int zw;
char data_reception[1];
char data[10];
for (i= 0; i&amp;lt;10; i++)
{
 zw=buf[i];
 sprintf(data_reception, &amp;quot;%d&amp;quot;, zw);
 strcat(data ,data_reception );
}
.....
}
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: receive data and send date LPC2294 ARM7</title><link>https://community.arm.com/thread/130413?ContentTypeID=1</link><pubDate>Thu, 01 Jan 2009 12:59:48 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:860da389-d612-4dd5-b310-c74f82d1d610</guid><dc:creator>Hotte Meyer</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hallo and sorry for the late answer I had not enough time the last
days ;-)&lt;br /&gt;
So I have check the Code at the Debug-Mode and my Programm runs. The
Programm send data to the PC but it receive nothing.&lt;br /&gt;
My questions stand in the variable *buf that what the PC send to the
MC and in the example LEDswitch in the main-funtion the do not call
the funktion &amp;quot;procrec&amp;quot; why? I have change my code with function call
procrec and in the Debug-Mode the programm runs in the funktion but
the variable *buf is 0x00.&lt;br /&gt;
Maybe somebody have a solution for the problem.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: receive data and send date LPC2294 ARM7</title><link>https://community.arm.com/thread/125155?ContentTypeID=1</link><pubDate>Wed, 24 Dec 2008 04:36:51 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9614fc81-00a1-461e-b473-89d933e006eb</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Debugging?&lt;/p&gt;

&lt;p&gt;
Does your code run the send_data() function?&lt;/p&gt;

&lt;p&gt;
What parts?&lt;/p&gt;

&lt;p&gt;
What is the return values from any tcp calls?&lt;/p&gt;

&lt;p&gt;
Do you get to tcp_send()? Does it give the expected return
value?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: receive data and send date LPC2294 ARM7</title><link>https://community.arm.com/thread/114568?ContentTypeID=1</link><pubDate>Wed, 24 Dec 2008 04:16:15 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f6b679e4-6cef-45d9-b52f-6e776e5b2119</guid><dc:creator>Hotte Meyer</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hallo,&lt;/p&gt;

&lt;p&gt;
Sorry, i expressed myself in an unclearly way. I have my code with
the part &amp;quot;max&amp;quot; changed but not post it again. I have set max for
example on 9. The Problem is the same. I can send the array to the PC
but I can not receive something from the PC. I do not know were my
mitakes are. Thanks for your help! Maybe you find some other mistakes
in my code.&lt;/p&gt;

&lt;p&gt;
Thx!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: receive data and send date LPC2294 ARM7</title><link>https://community.arm.com/thread/101493?ContentTypeID=1</link><pubDate>Wed, 24 Dec 2008 02:50:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:32e1d119-c745-438a-bf42-9d6e6a735f07</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Where?&lt;/p&gt;

&lt;p&gt;
To what?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: receive data and send date LPC2294 ARM7</title><link>https://community.arm.com/thread/77011?ContentTypeID=1</link><pubDate>Wed, 24 Dec 2008 02:01:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:623d0b9c-88b2-4146-a2fc-94a2793732b5</guid><dc:creator>Hotte Meyer</dc:creator><description>&lt;p&gt;&lt;p&gt;
@ Dan Henry&lt;/p&gt;

&lt;p&gt;
I have initialized max in send_data(). But I can not receive
something. Find you something else what wrong is?&lt;/p&gt;

&lt;p&gt;
Thx!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: receive data and send date LPC2294 ARM7</title><link>https://community.arm.com/thread/53155?ContentTypeID=1</link><pubDate>Tue, 23 Dec 2008 11:46:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:dece854f-70c7-422f-9b8c-e900c017b6d8</guid><dc:creator>ashley madison</dc:creator><description>&lt;p&gt;&lt;p&gt;
The first thing I saw was your use of uninitialized &amp;#39;max&amp;#39; in
send_data(). I stopped looking at that point.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>