When do I use System.Net.Sockets.TcpClient and System.Net.Sockets.Socket?

  • Thread starter Thread starter BadOmen
  • Start date Start date
B

BadOmen

Hi,

What is the different between 'System.Net.Sockets.Socket' and
'System.Net.Sockets.TcpClient'?
When do I use System.Net.Sockets.TcpClient and System.Net.Sockets.Socket??

Yours, Jonas
 
BadOmen said:
Hi,

What is the different between 'System.Net.Sockets.Socket' and
'System.Net.Sockets.TcpClient'?
When do I use System.Net.Sockets.TcpClient and System.Net.Sockets.Socket??

TcpClient is a helper class on top of Socket. It greatly simplifies writing
to tcp/ip sockets.
Sockets is a lower level and is capable of doing things other thatn tcp/ip,
like udp, raw sockets and even non-ip networking.

David
 
Here comes a bunch of follow up questions :P

David Browne said:
TcpClient is a helper class on top of Socket. It greatly simplifies writing
to tcp/ip sockets.

ok :-)
Sockets is a lower level and is capable of doing things other thatn tcp/ip,
like udp, raw sockets and even non-ip networking.

I have seen in VB6 raw socket option but I don't know what it is... What is
it? :-)

The TCP/IP connection will work at the same way as if I use
System.Net.Sockets.Socket it is just that I cant use raw sockets, udp and
non-ip networking?

what does it use instead of a IP? DNS

I want to make a little app. that can be able to read a html page from an
other computer using my app. (connect to my app. on an other computer and
see a html presentation) I also want to be able to send a text message to
that app. and save it in a XML page so I can look at it from any computer
with my app.
It will also be possible to send text messages between my app's. that will
not be saved just display at arrival.
Is this possible using the TcpClient?
 
BadOmen said:
Here comes a bunch of follow up questions :P



ok :-)


I have seen in VB6 raw socket option but I don't know what it is... What is
it? :-)

The TCP/IP connection will work at the same way as if I use
System.Net.Sockets.Socket it is just that I cant use raw sockets, udp and
non-ip networking?

correct, assuming you avoid the annoying little pitfalls of socket
programming that TcpClient protects you from.

what does it use instead of a IP? DNS

DNS runs on IP.
One hardly remembers anymore that there are networking protocols other than
IP, but look at:
System.Net.Sockets.ProtocolFamily
There're not all implemented, but it will give you an idea of of the level
of generality that the Socket represents.
I want to make a little app. that can be able to read a html page from an
other computer using my app. (connect to my app. on an other computer and
see a html presentation) I also want to be able to send a text message to
that app. and save it in a XML page so I can look at it from any computer
with my app.
It will also be possible to send text messages between my app's. that will
not be saved just display at arrival.
Is this possible using the TcpClient?

TcpClient is all you need. Perhaps TcpListener as well.
HTTP runs on top of TCP/IP, so you can use TCP/IP for everyting.

David
 
Back
Top