Bin Hu1,
If the socket function is failing, it could be due to a few different reasons. You should call the function 'fdError()' to get the error code that is being flagged. You can then check that error code with the constants defined in ti/ndk/inc/serrorno.h.
Please refer to the NDK API guide (spru524h.pdf) for information on the sockets APIs. Also, if you haven't read the NDK User's Guide (spru523h.pdf) and the NDK driver design guide (sprufp2_nspethdrvdesign.pdf)I would highly recommend these, too.
All of these documents are located in the docs directory of your NDK installation.
Steve