The steps to test the problem
1. Open TCP Server
2. Open TCP Client
3. TCP Client sends data to Server.
4. Close TCP Server and the client also crash without any notification
Second wonderful test:
1. Comment the following statement in Client.c (at line 168) and compile it
Code:
Writen( sockfd, data.send_buf, strlen( data.send_buf ), __FILE__, __LINE__ );
2. Run TCP Server
3. Run TCP Client (since no writen(), so response from server, it is OK)
4. Close TCP Server
5. A lot of rubbish from TCP Server.........
I also posted the source code here.
Compile TCP Server
Code:
gcc -Wall -lmcheck -g -Werror -lpthread -o server server.c
Compile TCP Client
Code:
gcc -Wall -lmcheck -g -Werror -lpthread -o client Client.c lib/*.c