Alexandre Kremer

TCP Server on M52233DEMO

Discussion created by Alexandre Kremer on Feb 5, 2007
Latest reply on Apr 2, 2008 by David Demers
 Hi all
 I´m trying to include a TCP Server in the ColdFire_Lite.mcp (Interniche sample program) but i´m facing some problems.
 Searching through some older threads in the forum, i could develope the attached code (tcp_server.c), wich i just add as a source file for the ColdFire_Lite.mcp.
 I modified the function int create_apptasks(void) on file tk_misc.c to create a new task wich is intended to be the new tcp server feature.
 I´m not using the msring structure as the http server does. I think it is unecessary since i want to make only one connection per session, not allowing multiple connections to be made in the same port.
 I can compile the project, burn it to flash and start debug, but then some problems happens:
1) The listening function works, putting the specific port to listen for incoming connections, and the TCP_check() function is called regularly BEFORE any connection is made. But when i connect succefully to the board, the TCP_check() function is not called anymore. It seems that the task is not being executed anymore right after a connectiona is made. It prints on uart the messagem "OPEN", wich indicates that the Callback routine is being called, but the TCP_check() routine, wich was being regularly called, is not called anymore right after this. Since i try to read the incoming data inside the TCP_check function, the result is that i can just connect to the target, but not process any incoming data.
2) When i close the connection and reconnect to the target it works fine for some times, but after a number of tries, i start to have memory problems, and the message "calloc1 failed: size 124, failures : n" where n is the number of erros (increased by the number of times i try to reconnect) is shown and the connection can´t be made.
 Please mates, any help is usefull to me, since i´m new to this coldfire chip.
 Thanks and best regards