Sample code to creating socket. JAVA and C++