base code with socket communication done.