Either use the .NET framework or read about the WinSock API (if you are using Windows), otherwise - for Linux - read about socket programming. There's plenty of information on the Internet and in books, but it's far too complicated a topic to cover in detail here.