Advertisement

Simple program..."Terminated"..."Killed"

Started by August 31, 2004 12:56 PM
2 comments, last by matt_j 20 years, 3 months ago
I have a simple lobby server program. It never had any problems on Windows, but when on Linux or FreeBSD, the program kills itself for no reason in a loop that looks like this:

		for(z=0;z<255;z++){
			if(cn[z].used){
				bre=cn[z].client.recv(f,SBSIZE,0);
				if(bre>0) handleinput(f, bre, z);
				if(bre==-1) err=errno;
				if (err!=EWOULDBLOCK) HandleClientSocketError(z,err);
			}
		}

It dies when a client is connected. I know it dies within this loop due to recent debugging. If no data comes in from recv, handleinput is not called, and when it terminates, no socket errors are reported. Any suggestions?
looks good to me, i guess your error is somewhere else. maybe a memory violation. there's a cool program to spot them - valgrind (developer.kde.org/~sewardj). it finds EVERYTHING! run your program with

valgrind --tool=addrcheck ./my-program my-parameters

and have a look at the output. most likely it will find the problem.
Advertisement
gdb your_program

run it, crash it, type "bt" and give us the backtrace. let's see what it looks like. maybe also tell us what line exactly causes the crash.
gdb seemed to be terminated with the program as well. I'll try the other suggestion.

This topic is closed to new replies.

Advertisement