PC Review


Reply
Thread Tools Rate Thread

AcceptTcpClient() / AcceptSocket()

 
 
PiotrKolodziej
Guest
Posts: n/a
 
      18th Jun 2006
Hi
What is the difference in using above functions?
They have the same description. Is there any common practice, when to use
one of them and where we shouldn't?

PK


 
Reply With Quote
 
 
 
 
Barry Kelly
Guest
Posts: n/a
 
      18th Jun 2006
"PiotrKolodziej" <(E-Mail Removed)> wrote:

> What is the difference in using above functions?
> They have the same description. Is there any common practice, when to use
> one of them and where we shouldn't?


TcpClient is a higher-level interface, while Socket is a lower-level
interface. TcpClient simply wraps a non-server TCP socket (i.e. a socket
that isn't listening).

The socket is always available through TcpClient.Client, so you don't
lose anything by going with TcpClient (this wasn't the case with .NET
1.1 and before, where TcpClient.Client was protected, IIRC).

If you're comfortable with working with the Socket class, you don't lose
anything by going with it alone. For example, to get a stream attached
to the read and write of the socket, you can new up a NetworkStream
around the socket.

-- Barry

--
http://barrkel.blogspot.com/
 
Reply With Quote
 
PiotrKolodziej
Guest
Posts: n/a
 
      19th Jun 2006
Thank You


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sock = listener.AcceptSocket(); vitagoni Microsoft C# .NET 9 10th Apr 2009 12:27 AM
How to terminate tcpListemer.AcceptTcpClient() ? Cylix Microsoft VB .NET 0 29th Jan 2007 01:09 AM
tcpListener.AcceptSocket strange behavior =?iso-8859-1?Q?Bj=F8rn_Eliasen?= Microsoft VB .NET 3 14th Aug 2006 02:36 AM
Getting the connected IP from TcpListener.AcceptTcpClient Benny Raymond Microsoft C# .NET 1 19th Oct 2005 09:11 PM
AcceptTcpClient() generates a exception A blocking operation was interrupted by a call to WSACancelBlockingCall Sagaert Johan Microsoft C# .NET 1 24th Mar 2005 02:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:08 PM.