Hello Here is my program
int main (void) { net_initialize(); socket = tcp_get_socket (TCP_TYPE_SERVER, 0, 20, tcp_callback); if (socket) { tcp_listen (socket, 4050); } if (tcp_check_send(socket) ){ sprintf(msg,"W%04d%04d%04d%04d%04d%04d%04d%04d%05dR\n",10,20,30,40,50,60,70,80,90); len=sizeof(msg); sendbuf = tcp_get_buf (len); memcpy (sendbuf, msg, len); tcp_send (socket, sendbuf,len); } osDelay (1000); } }
when I remove this par
if (tcp_check_send(socket) ){ sprintf(msg,"W%04d%04d%04d%04d%04d%04d%04d%04d%05dR\n",10,20,30,40,50,60,70,80,90); len=sizeof(msg); sendbuf = tcp_get_buf (len); memcpy (sendbuf, msg, len); tcp_send (socket, sendbuf,len); }
I can't connect to chip via TCP/IP protocol but it shows only
W0010002000300040005000600070008000090R
and the do nothing but connection is alive.and when I add
I can't open the port and I fail to connect to my chip.
what is my mistake?
Dear Reinhard Keil Thank you now I'm downloading MDK V7. But I find my problem but it is too strange. when I use sprintf without any variables with any size of string it works fine.
sprintf(msg,"HHHHHHHHHHellllooooooooooooooooo");
but as I add a little size variable to this command it doesn't work properly and I lose my connectivity or even it doesn't bind any port to my IP.
sprintf(msg,"W%04dR",10);
sprintf(msg,"W%04dR",var);
what do you think about this problem?
Hello I download the MDK v7.0 but ping command (in my pc) can't detect my board IP.My all configs are the same as the old ones ( with MDK v6.5) but it doesn't do anything.
uint32_t Tcp_Stat(int32_t socket, netTCP_Event event, const NET_ADDR *addr, const uint8_t *buf, uint32_t len) ; int main (void) { netInitialize (); sock = netTCP_GetSocket (Tcp_Stat); netTCP_SetOption (sock,netTCP_OptionTimeout, 120); if (sock >=0) { netTCP_Listen (sock, 4050); } while(1){} } uint32_t Tcp_Stat(int32_t socket, netTCP_Event event, const NET_ADDR *addr, const uint8_t *buf, uint32_t len) { switch (event) { case netTCP_EventConnect:return (1); case netTCP_EventEstablished:break; case netTCP_EventClosed :break; case netTCP_EventAborted:break; case netTCP_EventACK :break; case netTCP_EventData:break; } return (0); }
should I do anything else?