tcpclient socket webrequest

A

Aaron

tcpclient socket webrequest


what are each used for? I read some reference books and did some research on
the internet, but I'm still confused.
could someone clarify this for me?


Thanks,
Aaron
 
K

Kevin Spencer

Hi Aaron,

Basically, you're lloking at similar types of classes for different levels
of network communication.

A Socket is a class for any type of network connection. It is a low-level,
generic class for sending and receiving data over a network, and can work
with virtually any type of protocol.

A TCPClient is a higher-level class for working with the TCP protocol. It
has a Socket (protected Client property) that does the actual connection,
and has properties and methods for communicating via the TCP protocol.

A WebRequest is a higher-level class for sending an HTTP Request over a TCP
connection. It contains properties and methods for sending an HTTP Request,
as well as properties and methods for receiving the HTTP Response that comes
back.

These are an excellent example of how Microsoft provides programming tools
of virtually any level necessary to perform development tasks. For example,
you could write your own TCP Client class by creating a class that uses a
Socket to connect to a TCP port. You could further extend that class by
creating a class that sends an HTTP Request and listens for an HTTP
Response. But Microsoft has already created such classes for you. On the
other hand, if you needed to create an FTP client, which Microsoft has NOT
provided, you could start with a Socket and go from there, building your own
properties and methods to send and receive FTP proptocol messages over a TCP
port.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
A

Aaron

thank you.

i always thought the ftp protocal was built on tcp. so i need to use sockets
instead of tcpclient?

is there anything lower than sockets?
what is the lowest level .Net can access? what about C/native unmanged?

Aaron
 
K

Kevin Spencer

is there anything lower than sockets?
what is the lowest level .Net can access? what about C/native unmanged?

Yes, there is PLENTY lower than Sockets. As for the lowest level that .Net
can access, I would have to guess Assembler (not MSIL - Assembler), as C
allows inline Assembler, C++ is a superset of C, and C# allows inline C++
(unsafe/unmanaged). On the other hand, I wouldn't know for sure, as I
haven't had occasion to use Assembler for many years!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top