Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCPclient/Socket class

Status
Not open for further replies.

luvcloud

Programmer
Apr 23, 2002
24
0
0
MY
i read that there are several ways to create sockets, through TcpClient/TcpListener, Socket and UdpClient classes. is there any difference between TcpClient/TcpListener and the Socket class? I mean, how do i know which one to use?
 
The Socket class is an implementation of classic Berkeley Sockets. The TcpClient and TcpListener is specific to Microsoft.

Use Socket if you're already familiar with writing BSD socket calls, or porting a Socket library program to .NET

Use TcpClient and/or TcpListener if you're starting from scratch and are going 100% .NET development, as the TcpClient has a method called GetStream(), that returns a NetworkStream object. You can then hook that up to all the existing stream functionality in .NET (cryptography, file I/O, compression, etc.).

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top