a project of networking protocol
src
: all the code of the Http server, which include a Makefile and source code.pre
: The study code, some test code of socket interfaces like select,poll, epoll and so on.bgnet_examples
- the code ofBeej's Guide to Network Programming
tutorial
- some test code.
- change the location to
./src
dirtory. - using epoll dispatcher, make sure the event_loop->event_dispatcher in the
event_loop.c
equal to&epoll_dispatcher
; using poll dispatcher, change the value to&poll_dispatcher
. - using
make
to compile the code, then you will get an executable file - run the executable file, it will run the sercer in
localhost:21042
- open a new terminal window, using ab tool with
ab -n 10000 -c 100 -k http://127.0.0.1:21042/
command to test.
- using gdb debug the child process:
-exec set follow-fork-mode child
- check which process occupy one port:
lsof -i:<port>
, for instance,lsof -i:8080
- check if system open dump core function by
ulimit -c
. - if the output is 0, using
ulimit -c unlimited
- install
coredumpctl
tool, the core dump file will in/var/lib/systemd/coredump/
- examine the backtrace using gdb
#coredumpctl gdb app_name
(gdb) bt
details can be seen in this wiki