>I am programming simple TCP server.
Some packets causes server to get segmentation fault.
Is it possible to handle segmentation fault and log that packet and
make server to continue running?
Try fixing the original problem. Whatever caused the segfault
(buffer overflow?) may have mortally wounded the server so badly
it can't function properly again. You are also not guaranteed to
be able to restart after a segfault (and if you don't fix the bad
pointer or array subscript, you're likely to get another one almost
immediately anyway).
If possible can you provide me some example or tutorials please.
Learn how to use a debugger and read a stack trace. Also, try to
write a client that can consistently crash the server whenever you
want, so you can quickly reproduce the problem.
Another possibility is to keep restarting the server whenever it
dies. There's lots of ways to do this, from a shell while loop
to the 'daemontools' software, which lets you have better controls
over logging, taking the server down intentionally, etc.
Gordon L. Burditt