Connect to the server which listened data on the specific port
socket call sequence:
socket ==> OK
fcntl (set nonblocking mode) > OK
connect (immediately return because the file descriptor is in the nonblocking mode) ==> OK
select write socket (verify if the write socket is available or not) ==> OK
a1. select read socket (verify if the read socket is available or not) ==> OK (if the server will first send the data to the connected client)
a2. recv (recv the data) ==> OK (if the server will first send the data to the connected client)
b1. select read socket (verify if the read socket is available or not) ==> Failed (if the server doesn't send the data to the connected client)
b2. recv (recv the data) ==> No need to call the recv because the recv socket is not ready
Connect to the server which doesn't listen data on the specific port
socket call sequence:
socket ==> OK
fcntl (set nonblocking mode) ==> OK
connect (immediately return because the file descriptor is in the nonblocking mode) ==> OK
select write socket (verify if the write socket is available or not) ==> OK
select read socket (verify if the read socket is available or not) ==> OK
recv (recv the data) ==> return -1
This area is my sharing area. Include some technical/believing/life experiences. Hope you can enjoy with me. God bless you. :)
2009年1月15日 星期四
2009年1月14日 星期三
Library in compiler time and execution time
Compilation time
static library
link with *.a file
dynamic library
link with *.so file
Execution time
static library
No need to link libraries
dynamic library
link to the specific libraries files *.so.X (Can use ldd to display the real libraries)
static library
link with *.a file
dynamic library
link with *.so file
Execution time
static library
No need to link libraries
dynamic library
link to the specific libraries files *.so.X (Can use ldd to display the real libraries)
2009年1月13日 星期二
Default linux kernel header source path
On most linux systems (includeing RedHat, debian, and any system someone
built their own kernel and ran 'make modules_install'),
/lib/modules/`uname -r`/build
Above path points to the correct kernel headers.
built their own kernel and ran 'make modules_install'),
/lib/modules/`uname -r`/build
Above path points to the correct kernel headers.
訂閱:
文章 (Atom)