stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
TCPIP example returns unexpected data?! |
Posted: Fri Mar 15, 2013 3:27 am |
|
|
Hi, everyone! I`m using TCPIP stack v30_nov_06! I`m trying to rework ex13b.c. So witout any changes this example returns something like this:
Code: |
BUTTON C=0 gafadfaf
gfadgas
fgdafdadffdsfhjhgjhert
rtrewtytrhdfs
trsdtgfhfsda
.......
bla bla bla
|
I`m connecting to the PCB through TELNET
Code: | telnet 192.168.0.3 1000 |
I tried to rework the TCPConnectedTask():
Code: |
int8 TCPConnectedTask(TCP_SOCKET socket, int8 which)
{
char c;
static int8 counter[NUM_LISTEN_SOCKETS];
static int8 button1_held[NUM_LISTEN_SOCKETS];
char str[13]="Hello server";
int8 i=0;
if (TCPIsGetReady(socket)) {
while (TCPGet(socket, &c)) {
lcd_str[which][i++]=c;
if (i>=20) {i=19;}
lcd_str[which][i]=0;
}
}
if(TCPIsPutReady(socket))
{
TCPPutArray(socket,str,strlen(str));
TCPFlush(socket);
}
return(TRUE);
}
|
to be more simple. It just returns Hello server and closes the connection. But again after Hello server I recieve about 10 extra rows with extra meaningless data.
Can you tell me am I doing anything wrong??
How to remove this extra data?
Thanks! |
|