Skip to content
- Tutorials
- Python Tutorial
- Taking Input in Python
- Python Operators
- Python Data Types
- Python Loops and Control Flow
- Python Functions
- Python OOPS Concept
- Python Data Structures
- Python Exception Handling
- Python File Handling
- Python Exercises
- Java
- Java Programming Language
- Java Collections
- Java 8 Tutorial
- Java Programs
- Java Interview Questions
- Java Exercises
- Java Quiz
- Java Projects
- Advance Java
- Programming Languages
- System Design
- Interview Corner
- Computer Science Subjects
- DevOps
- Linux
- Software Testing
- Databases
- Android
- Excel
- Mathematics
- Python Tutorial
- DSA
- Data Structures
- Algorithms
- Analysis of Algorithms
- Searching Algorithms
- Sorting Algorithms
- Greedy Algorithms
- Dynamic Programming
- Graph Algorithms
- Pattern Searching
- Recursion
- Backtracking
- Divide and Conquer
- Mathematical Algorithms
- Geometric Algorithms
- Bitwise Algorithms
- Randomized Algorithms
- Branch and Bound
- Algorithms Tutorial
- DSA Tutorial
- Practice
- All DSA Problems
- Problem of the Day
- Company Wise Coding Practice
- GfG SDE Sheet
- Practice Problems Difficulty Wise
- Language Wise Coding Practice
- Curated DSA Lists
- Competitive Programming
- Company Wise SDE Sheets
- DSA Cheat Sheets
- Top Interview Questions
- Puzzles
- Data Science
- Web Tech
- Courses
-
Last Updated : 27 May, 2022
Summarize
Comments
Improve
A network that is connected with two devices as a link to execute two-way communication on the network. It receives and sends data to the devices. The socket address is a combination of IP address and port. In the TCP/IP layer, a socket is bound as a port number which can identify whether the data is to be sent to an application or not. The transport layer in the socket is the core mechanism for managing and establishing communication between the devices.
Sockets are used as a communication device or interaction between the client and server. It receives information from the client and sends information to the client and disconnects it after receiving the data.
Types of Socket:
1. Datagram Sockets: Datagram sockets allow processes to use the User Datagram Protocol (UDP). It is a two-way flow of communication or messages. It can receive messages in a different order from the sending way and also can receive duplicate messages. These sockets are preserved with their boundaries. The socket type of datagram socket is SOCK_DGRAM.
2. Stream Sockets: Stream socket allows processes to use the Transfer Control Protocol (TCP) for communication. A stream socket provides a sequenced, constant or reliable, and two-way (bidirectional) flow of data. After the establishment of connection, data can be read and written to these sockets in a byte stream. The socket type of stream socket is SOCK_STREAM.
3. Raw Sockets: Raw Socket provide user access to the Internet Control Message Protocol (ICMP). Raw sockets are not used for most applications. These sockets are the same as the datagram oriented, their characteristics are dependent on the interfaces. They provided support in developing new communication protocols or for access to more facilities of an existing protocol. Only the superusers can access the Raw Sockets. The socket type of Raw Socket is SOCK_RAW.
4. Sequenced Packet Sockets: Sequenced Packet Sockets are similar to the stream socket, with the exception that record boundaries are preserved in-stream sockets. The given interface in this section is of Network System ( NS) that has an abstraction of Sockets and is ordered in all the applications. The Sequenced Packet Sockets enable the user to multiply the sequence packet protocol or some IDP (Internet Datagram Protocol) which heads on the packet or a packet group by writing in the header of the prototype along with the data that has been sent. The socket type of Sequenced Packet Socket is SOCK_SEQPACKET.
Please Login to comment...
Similar Reads
Difference between Secure Socket Layer (SSL) and Secure Electronic Transaction (SET)
Secure Socket Layer (SSL): Secure Socket Layer (SSL) is the normal security technology for establishing an associate encrypted link between an internet server and a browser. This link ensures that each knowledge passed between the online server and browsers stays personal and integral. SSL is associate trade normal and is employed by numerous websi
7 min read
Socket in Computer Network
A socket is one endpoint of a two way communication link between two programs running on the network. The socket mechanism provides a means of inter-process communication (IPC) by establishing named contact points between which the communication take place. Like 'Pipe' is used to create pipes and sockets is created using 'socket' system call. The s
2 min read
Difference between Rest API and Web Socket API
In IoT, there are 2 communication APIs - REST Based Communication APIsWeb Socket Based Communication APIs Web service can either be implemented using REST principles or using Web Socket Protocol - 1. REST Based Communication API : REpresentational State Transfer (REST) is a set of architectural principles by which you can design web services and we
4 min read
Socket Programming in Java
This article describes a very basic one-way Client and Server setup where a Client connects, sends messages to the server and the server shows them using a socket connection. There's a lot of low-level stuff that needs to happen for these things to work but the Java API networking package (java.net) takes care of all of that, making network program
5 min read
Socket Programming with Multi-threading in Python
Prerequisite : Socket Programming in Python, Multi-threading in PythonSocket Programming-> It helps us to connect a client to a server. Client is message sender and receiver and server is just a listener that works on data sent by client.What is a Thread? A thread is a light-weight process that does not require much memory overhead, they are che
3 min read
Secure Socket Layer (SSL)
Secure Socket Layer (SSL) provides security to the data that is transferred between web browser and server. SSL encrypts the link between a web server and a browser which ensures that all data passed between them remain private and free from attack.In this article, we are going to discuss SSL in detail, its protocols, the silent features of SSL, a
11 min read
Difference between Socket and Port?
Both Socket and Port are the terms used in Transport Layer. A port is a logical construct assigned to network processes so that they can be identified within the system. A socket is a combination of port and IP address. Port number can be represented by a single number ( example: 1028) on the other hand socket address can be represented by (tcp, ho
6 min read
Difference between RMI and Socket
This article describes techniques for Client and Server setup where a Client connects, sends messages to the server and the server shows them using a connection and vice versa. RMI and Sockets both are used to establish a connection between client and server but there are some major differences between RMI and Socket, let's look into it. but before
4 min read
See AlsoTCP SocketDifference Between Secure Socket Layer (SSL) and Transport Layer Security (TLS)
SSL stands for Secure Socket Layer while TLS stands for Transport Layer Security. Both Secure Socket Layer and Transport Layer Security are the protocols used to provide security between web browsers and web servers. The main difference between Secure Socket Layer and Transport Layer Security is that, in SSL (Secure Socket Layer), the Message diges
4 min read
Types of Network Address Translation (NAT)
Prerequisite - Network address translation (NAT) Network Address Translation (NAT) is a process in which one or more local IP address is translated into one or more Global IP address and vice versa in order to provide Internet access to the local hosts. NAT generally operates on a router or firewall. Network address translation (NAT) working - Gene
4 min read
Different Types of Clustering Algorithm
The introduction to clustering is discussed in this article and is advised to be understood first. The clustering Algorithms are of many types. The following overview will only list the most prominent examples of clustering algorithms, as there are possibly over 100 published clustering algorithms. Not all provide models for their clusters and can
5 min read
Types of Sources of Data in Data Mining
In this post, we will discuss what are different sources of data that are used in data mining process. The data from multiple sources are integrated into a common source known as Data Warehouse. Let's discuss what type of data can be mined: Flat FilesFlat files is defined as data files in text form or binary form with a structure that can be easily
6 min read
Types of Spanning Tree Protocol (STP)
Prerequisite - Spanning Tree Protocol Spanning Tree Protocol (STP) is used to make a loop free network by monitoring the network to track all the links and shut down the least redundant ones. Root bridge is a switch in a single VLAN or whole topology (according to the type of STP standard used) which is responsible for distributing BPDUs and block
3 min read
Types of Viruses
A virus is a fragment of code embedded in a legitimate program. Viruses are self-replicating and are designed to infect other programs. They can wreak havoc in a system by modifying or destroying files causing system crashes and program malfunctions. On reaching the target machine a virus dropper(usually a trojan horse) inserts the virus into the s
4 min read
Types of MANET in Computer Network
Prerequisite - MANET: Mobile Ad hoc Network MANET stands for Mobile ad hoc Network also called as wireless ad hoc network or ad hoc wireless network. They consist of a set of mobile nodes connected wirelessly in a self-configured, self-healing network without having a fixed infrastructure. MANET nodes are free to move randomly as the network topolo
12 min read
Types of Schedules in DBMS
Schedule, as the name suggests, is a process of lining the transactions and executing them one by one. When there are multiple transactions that are running in a concurrent manner and the order of operation is needed to be set so that the operations do not overlap each other, Scheduling is brought into play and the transactions are timed accordingl
7 min read
Types of DNS Attacks and Tactics for Security
Prerequisite - Domain Name Server, DNS Spoofing or DNS Cache poisoning Domain Name Server is a prominent building block of the Internet. It's developed as a system to convert alphabetical names into IP addresses, allowing users to access websites and exchange e-mails. DNS is organized into a tree-like infrastructure where the first level contains t
3 min read
MIME Media Types
MIME media types basically stand for Multipurpose Internet Mail Extension media types. These media types were originally created to make emails include information other than only plain text. These media types show us the following things: How text and attachment are combined into a single message or email.How different items are encoded for transm
2 min read
Types of Email Attacks
Many people rely on the Internet for many of their professional, social, and personal activities. But there are also people who attempt to damage our Internet-connected computers, violate our privacy and render inoperable Internet services. Email is a universal service used by over a billion people worldwide. As one of the most popular services, em
5 min read
Types of Wireless and Mobile Device Attacks
Wireless and mobile devices have become ubiquitous in today's society, and with this increased usage comes the potential for security threats. Wireless and mobile device attacks are a growing concern for individuals, businesses, and governments. Below are some of the most common types of Wireless and Mobile Device Attacks: SMiShing: Smishing become
5 min read
Types of Blockchain and Chain Terminology
Prerequisites: Introduction to Blockchain technology | Set 1, Set 2 In the above two articles, we have seen what blockchain technology is and got brief information about types of blockchain. In this article, we will discuss in detail two main types of blockchain and the terminologies related to types of chains. There are mainly three types of block
3 min read
Types and Uses of Backbone Networks
Backbone is most important part of a system which provides the central support to the rest system, for example backbone of a human body that balance and hold all the body parts. Similarly in Computer Networks a Backbone Network is as a Network containing a high capacity connectivity infrastructure that backbone to the different part of the network.
4 min read
Types of Virtual Private Network (VPN) and its Protocols
VPN stands for Virtual Private Network (VPN), that allows a user to connect to a private network over the Internet securely and privately. VPN creates an encrypted connection that is called VPN tunnel, and all Internet traffic and communication is passed through this secure tunnel. Virtual Private Network (VPN) is basically of 2 types: 1. Remote Ac
7 min read
Types Of Information System
DEFINITION OF INFORMATION SYSTEM - " An information system is a set of interrelated components that works together to collect, process, store and breakdown the information to support decision making. " Following are the DIMENSIONS of information system: 1.ORGANIZATIONAL DIMENSION : Information system are part of organization. Information system wil
3 min read
Web Scripting and its Types
The process of creating and embedding scripts in a web page is known as web-scripting. A script or a computer-script is a list of commands that are embedded in a web-page normally and are interpreted and executed by a certain program or scripting engine. Scripts may be written for a variety of purposes such as for automating processes on a local-co
2 min read
Working and Types of Smart Card
Smart Card is a physical electronic authorization device used to control data accessing and data manipulation. It is basically plastic embedded with an integrated circuit. On the smart card, either a memory chip or a microprocessor is fabricated to store the data and connect with the system. Smart Card working process:Step-1: Smart card is inserted
4 min read
Types of VPN Tunneling
Tunneling is the technique of putting an integrated data packet into another packet (which contains routing information) and sending it over the internet. The packets travel through a path which is known as tunnel. To secure a tunneled transmission against interception, all traffic over a VPN is encrypted for safety. Virtual Private Network (VPN) s
2 min read
Types of Two-factor Authentication
Two-factor Authentication refers to the use of any two self-reliant methods from the various authentication methods. Two-factor authentication is used to ensure that the user has been recognized to access secure systems and to increase the security. Two-factor authentication is first implemented for laptops because of the fundamental security liabi
4 min read
Automation and its Types
Just look at a scenario where we want to submit our electricity bill in normal case what we do, we go to the electricity center and fill the form and then submit our bill in this situation the complete task is done by a human. But in our day to day life we don't have that much time to do these task by yourself so here to overcome these situation th
2 min read
Types of APPN Nodes
Advanced Peer-to-Peer Networking (APPN) is the moment generation of Systems Network Architecture (SNA). It was created by IBM to meet these prerequisites: To supply a compelling directing convention to permit SNA activity to stream natively and concurrently with other protocols.To permit sessions to be built up between the conclusion clients withou
3 min read
Article Tags :
Trending in News
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id, check: true }), success:function(result) { jQuery.ajax({ url: writeApiUrl + 'suggestions/auth/' + `${post_id}/`, type: "GET", dataType: 'json', xhrFields: { withCredentials: true }, success: function (result) { $('.spinner-loading-overlay:eq(0)').remove(); var commentArray = result; if(commentArray === null || commentArray.length === 0) { // when no reason is availaible then user will redirected directly make the improvment. // call to api create-improvement-post $('body').append('
'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id, }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.unlocked-status--improve-modal-content').css("display","none"); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); return; } var improvement_reason_html = ""; for(var comment of commentArray) { // loop creating improvement reason list markup var comment_id = comment['id']; var comment_text = comment['suggestion']; improvement_reason_html += `
${comment_text}
`; } $('.improvement-reasons_wrapper').html(improvement_reason_html); $('.improvement-bottom-btn').html("Create Improvement"); $('.improve-modal--improvement').hide(); $('.improvement-reason-modal').show(); }, error: function(e){ $('.spinner-loading-overlay:eq(0)').remove(); // stop loader when ajax failed; }, }); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); } else { if(loginData && !loginData.isLoggedIn) { $('.improve-modal--overlay').hide(); if ($('.header-main__wrapper').find('.header-main__signup.login-modal-btn').length) { $('.header-main__wrapper').find('.header-main__signup.login-modal-btn').click(); } return; } } }); $('.left-arrow-icon_wrapper').on('click',function(){ if($('.improve-modal--suggestion').is(":visible")) $('.improve-modal--suggestion').hide(); else{ $('.improvement-reason-modal').hide(); } $('.improve-modal--improvement').show(); }); function loadScript(src, callback) { var script = document.createElement('script'); script.src = src; script.onload = callback; document.head.appendChild(script); } function suggestionCall() { var suggest_val = $.trim($("#suggestion-section-textarea").val()); var array_String= suggest_val.split(" ") var gCaptchaToken = $("#g-recaptcha-response-suggestion-form").val(); var error_msg = false; if(suggest_val != "" && array_String.length >=4){ if(suggest_val.length <= 2000){ var payload = { "gfg_post_id" : `${post_id}`, "suggestion" : `
${suggest_val}
`, } if(!loginData || !loginData.isLoggedIn) // User is not logged in payload["g-recaptcha-token"] = gCaptchaToken jQuery.ajax({ type:'post', url: "https://apiwrite.geeksforgeeks.org/suggestions/auth/create/", xhrFields: { withCredentials: true }, crossDomain: true, contentType:'application/json', data: JSON.stringify(payload), success:function(data) { jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-section-textarea').val(""); jQuery('.suggest-bottom-btn').css("display","none"); // Update the modal content const modalSection = document.querySelector('.suggestion-modal-section'); modalSection.innerHTML = `
Thank You!
Your suggestions are valuable to us.
You can now also contribute to the GeeksforGeeks community by creating improvement and help your fellow geeks.
`; }, error:function(data) { jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Something went wrong."); jQuery('#suggestion-modal-alert').show(); error_msg = true; } }); } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Minimum 5 Words and Maximum Character limit is 2000."); jQuery('#suggestion-modal-alert').show(); jQuery('#suggestion-section-textarea').focus(); error_msg = true; } } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Enter atleast four words !"); jQuery('#suggestion-modal-alert').show(); jQuery('#suggestion-section-textarea').focus(); error_msg = true; } if(error_msg){ setTimeout(() => { jQuery('#suggestion-section-textarea').focus(); jQuery('#suggestion-modal-alert').hide(); }, 3000); } } document.querySelector('.suggest-bottom-btn').addEventListener('click', function(){ jQuery('body').append('
'); jQuery('.spinner-loading-overlay').show(); if(loginData && loginData.isLoggedIn) { suggestionCall(); return; } // load the captcha script and set the token loadScript('https://www.google.com/recaptcha/api.js?render=6LdMFNUZAAAAAIuRtzg0piOT-qXCbDF-iQiUi9KY',[], function() { setGoogleRecaptcha(); }); }); $('.improvement-bottom-btn.create-improvement-btn').click(function() { //create improvement button is clicked $('body').append('
'); $('.spinner-loading-overlay').show(); // send this option via create-improvement-post api jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.improvement-reason-modal').hide(); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); });