Fix some issues with socket and reformat all codes.

Change-Id: I0000000000000000000000000000000000000002
Signed-off-by: Silencieux Le <silencieux.le@gmail.com>