Python Socket Programming How To Create Socket

In this Python Socket Programming i want to show you How To Create Socket.

 

What is a Socket ?

a network socket is a virtual end point where entities
can perform inter-process communication. For example, one process sitting in a
computer, exchanges data with another process sitting on the same or another
computer. We typically label the first process which initiates the communication
as the client and the another one as the server.

 

 

So now this is the creation of Python Socket Programming How To Create Socket

 

 

OK in the above code first we have created the object for the socket, and also we need to give some parameters for the class

 

 

 

Family : This is the domain of socket, such as AF_INET (about
90 percent of the sockets of the Internet fall under this category) or AF_UNIX,
which is sometimes used as well. In Python 3, you can create a Bluetooth
socket using AF_BLUETOOTH.

 

OK now the second one is Socket type: Depending on your need, you need to specify the type of socket. For example, TCP and UDP-based sockets are created by specifying
SOCK_STREAM and SOCK_DGRAM, respectively.

 

Protocol: This specifies the variation of protocol within a socket family
and type. Usually, it is left as zero.

 

 

Run the code and this will be the result 

Python Socket Programming How To Create Socket

 

 

 

Also you can watch the complete video for this article

 

 

Subscribe and Get Free Video Courses & Articles in your Email

 

Share via
Copy link
Powered by Social Snap
×