update socket sample code