What are Sockets? And how to develop in C #?

5

I have to develop a socket, but I do not know what it is or how it works! I want to know what it takes to create a socket in C #, I'm using Visual Studio as IDE.

    
asked by anonymous 20.04.2016 / 01:08

1 answer

8

Socket is the end point of communicating data from one process to another on the same machine or another. It is a mechanism typically provided by operating systems to establish data communication.

This can be obtained with the class Socket in .Net. You have an example on the documentation page.

Basic example:

var Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

Some forms of communication a>, types of "jacks" different (Stream, Dgram, Raw, Rdm, Seqpacket) and #

You should only use it to build low-level communication engine. You have to have a good understanding of data communication. In general, whoever uses this is the one who will do custom FTP, HTTP, SMTP, etc. mechanism, or who needs the use of direct communication at a lower level and is willing to handle all the necessary details. If you do not have a good reason to use it, choose another mechanism.

Practical examples .

    
20.04.2016 / 01:25