Creating Live Streaming Video Chat App without voice using cv2 module of Python
Hello Connections…
🤷♂️ I am here with team task 3 from the #summertraining under the Mentorship of Vimal Daga Sir.
Our team have tried Creating Live Streaming Video Chat App without voice using cv2 module of Python.
Let’s directly jump into the explanation and coding part…
SERVER SIDE
Part:01
We will be importing the required libraries for further procedures. They are-Socket, json, pickle, cv2
Part-02
Now in order to establish the connection between client and server. We will be accessing the port number and IP address.
Part-03
This time we will be using the bind function that would assign as the IP address and port number to a socket instance and also using a listen function that would be useful when the server have more than one request.
Part-04
here we will be typically storing the data into variables and changing their storing parameters and will be employing the while loop for condition satisfaction and also making use of the error handling in order to avoid the further error that would encourage the user experience.
CLIENT SIDE
Thanks
Task Description: 📄
Create your own chat servers, and establish a network to transfer data using socket programing by creating both server and client machines as sender and receiver.
Few things to know :
What is a Server?
A server is either a program, a computer, or a device that is devoted to managing network resources. There are various types of servers such as database servers, network servers, print servers, etc.
What is a Client?
A client is either a computer or software that receives information or services from the server. In a client-server module, clients requests services from servers. The best example is a web browser such as Google Chrome, Firefox, etc.
Sockets
Sockets are the backbone of networking. They make the transfer of information possible between two different programs or devices. For example, when we open up a browser, we as clients are creating a connection to the server for the transfer of information. A single network will have two sockets, one for each communicating device or program. These sockets are a combination of an IP address and a Port. A single device can have ’n’ number of sockets based on the port number that is being used.
Some of the common methods,
socket(): This method is used to create the socket and takes two arguments first is a family or domain like AF_INET (IPv4) or INET6 (IPv6) and the second defines the type of sockets like SOCK_STREAM ( TCP ) or SOCK_DGRAM ( UDP ).
bind(): This method is used to bind your socket with a specific host and port which will be passed as an argument to this function and that means your socket will be sitting at a specific location where the client socket can send its data.
recvfrom(): This method can be used with a UDP server to receive data from a UDP client or it can be used with a UDP client to receive data from a UDP server. It accepts a positional parameter called bufsize which is the number of bytes to be read from the UDP socket. It returns a byte object read from a UDP socket and the address of the client socket as a tuple.
sendto(): It is a method of Python’s socket class that is used to send datagrams to a UDP socket. The communication could be from either side. It could be from client to server or from the server to a client. The data to be sent must be in bytes format. If the data is in string format, the str. encode() method can be used to convert the strings to bytes. We must also pass a tuple consisting of IP address and port number.
Socket Programming
Socket programming is a way of connecting two nodes on a network to communicate with each other. One socket(node) listens on a particular port at an IP, while the other socket reaches out to the other to form a connection. The server forms the listener socket while the client reaches out to the server.
UDP:
User Datagram Protocol (UDP) is a Transport Layer protocol. UDP is a part of the Internet Protocol suite, referred to as UDP/IP suite. Unlike TCP, it is an unreliable and connectionless protocol. So, there is no need to establish a connection prior to the data transfer.
Features of UDP
· Supports bandwidth-intensive applications that tolerate packet loss
· Less delay
· It sends the bulk quantity of packets.
· Possibility of data loss
· Allows small transaction (DNS lookup)
✍ You can get the code in the link given below:
#vimaldaga #righteducation #educationredefine #rightmentor #worldrecordholder #linuxworld #makingindiafutureready #righeducation #summertraining