Sample code for socket programming