adding multithreading

adding multi threading and basic socket communcation