some demo code of socket