Oh....
First... To what are you trying to connect ?
And Web server ? a File server ? a Game server ?
Or... simply... A Custom server that youll made.
Tell me what you want. Instead of giving you a general solution, I might give you a easier one that is already implemented in .NET.