As outlined above, by other members, you seems to have a lot of good will, but some background holes :)
Let think about what you want achive:
1. A client try to connect to a server to achieve data
2. A server
should be Listening for a connection
3. The server see a connection request and
accept it
4. Both partners send and receive data writing and reading from the connected socket
Now the points 2 and 3 are missing from your code.
Both, client and server, try to connect to something, but no code to
accept the connection is present.
See[
^] this code as starting point.
And, as usual, good luck ;)