You will be needing windows socket programming for that. SOrry but i cannot give you everything here as this is a vast topic but i suggest reading a little bit about windows sockets in C++ will give you full understanding.
However if you could find this book you will get very good explanation and a lot of sample code to play around with. Perhaps some code from the book itself will fulfill your needs:
Windows Network programming[
^]