Socket Programming

Description

CNOS Mind Map on Socket Programming, created by h_10 on 06/03/2014.
h_10
Mind Map by h_10, updated more than 1 year ago
h_10
Created by h_10 about 10 years ago
214
0

Resource summary

Socket Programming
  1. What is a socket?
    1. Sockets is a method for communication between a client program and a server program in a network. A socket is defined as "the endpoint in a connection.
      1. Sockets are created and used with a set of programming requests or "function calls" sometimes called the sockets application programming interface (API).
      2. What are the two types of sockets?
        1. Stream Sockets

          Annotations:

          • A stream socket is like a phone call -- one side places the call, the other answers, you say hello to each other (SYN/ACK in TCP), and then you exchange information. Once you are done, you say goodbye (FIN/ACK in TCP). If one side doesn't hear a goodbye, they will usually call the other back since this is an unexpected event; usually the client will reconnect to the server. There is a guarantee that data will not arrive in a different order than you sent it, and there is a reasonable guarantee that data will not be damaged.
          1. Stream sockets are reliable two-way connected communication streams. If you output two items into the socket in the order "1, 2", they will arrive in the order "1, 2" at the opposite end. They will also be error free.
            1. the telnet application, yes? It uses stream sockets. All the characters you type need to arrive in the same order you type them, right? Also, web browsers use the HTTP protocol which uses stream sockets to get pages.
              1. A stream socket is like a phone call -- one side places the call, the other answers, you say hello to each other (SYN/ACK in TCP), and then you exchange information. Once you are done, you say goodbye (FIN/ACK in TCP). If one side doesn't hear a goodbye, they will usually call the other back since this is an unexpected event; usually the client will reconnect to the server. There is a guarantee that data will not arrive in a different order than you sent it, and there is a reasonable guarantee that data will not be damaged.
                1. So you use a stream socket when having information in order and intact is important. File transfer protocols are a good example here. You don't want to download some file with its contents randomly shuffled around and damaged!
                  1. Stream sockets uses TCP
                  2. Datagram Sockets
                    1. A datagram socket is like passing a note in class. Consider the case where you are not directly next to the person you are passing the note to; the note will travel from person to person. It may not reach its destination, and it may be modified by the time it gets there. If you pass two notes to the same person, they may arrive in an order you didn't intend, since the route the notes take through the classroom may not be the same, one person might not pass a note as fast as another, etc.
                      1. You'd use a datagram socket when order is less important than timely delivery
                      2. How do stream sockets achieve this high level of data transmission quality? They use a protocol called "The Transmission Control Protocol", otherwise known as "TCP"
                    2. TCP
                      1. TCP is known as a connection-oriented protocol, which means that a connection is established and maintained until such time as the message or messages to be exchanged by the application programs at each end have been exchanged
                        1. TCP is responsible for ensuring that a message is divided into the packets that IP manages and for reassembling the packets back into the complete message at the other end. In the Open Systems Interconnection (OSI) communication model, TCP is in layer 4, the Transport Layer.
                          1. Reliability: TCP is connection-oriented protocol. When a file or message send it will get delivered unless connections fails. If connection lost, the server will request the lost part. There is no corruption while transferring a message.
                            1. Ordered: If you send two messages along a connection, one after the other, you know the first message will get there first. You don't have to worry about data arriving in the wrong order
                              1. Heavyweight: - when the low level parts of the TCP "stream" arrive in the wrong order, resend requests have to be sent, and all the out of sequence parts have to be put back together, so requires a bit of work to piece together
                                1. Streaming: Data is read as a "stream," with nothing distinguishing where one packet ends and another begins. There may be multiple packets per read call.
                                  1. TCP is one of the main protocols in TCP/IP networks. Whereas the IP protocol deals only with packets, TCP enables two hosts to establish a connection and exchange streams of data. TCP guarantees delivery of data and also guarantees that packets will be delivered in the same order in which they were sent

                                    Annotations:

                                    • Transmission Control Protocol
                                    1. TCP is Internet Protocol, which is a set of networking protocols that allows two or more computers to communicate.
                                      1. Transmission Control Protocol knows as TCP.
                                      2. UDP
                                        1. UDP (User Datagram Protocol) is a communications protocol that offers a limited amount of service when messages are exchanged between computers in a network that uses the Internet Protocol (IP).
                                          1. UDP (User Datagram Protocol) is a simple OSI transport layer protocol for client/server network applications based on Internet Protocol (IP). UDP is the main alternative to TCP and one of the oldest network protocols in existence, introduced in 1980.
                                            1. UDP network traffic is organized in the form of datagrams. A datagram comprises one message unit. The first eight (8) bytes of a datagram contain header information and the remaining bytes contain message data.
                                              1. Like the Transmission Control Protocol, UDP uses the Internet Protocol to actually get a data unit (called a datagram) from one computer to another. Unlike TCP, however, UDP does not provide the service of dividing a message into packets (datagrams) and reassembling it at the other end. other en
                                                1. UDP provides two services not provided by the IP layer. It provides port numbers to help distinguish different user requests and, optionally, a checksum capability to verify that the data arrived intact.
                                                  1. In the Open Systems Interconnection (OSI) communication model, UDP, like TCP, is in layer 4, the Transport Layer.
                                                    1. Reliability: UDP is connectionless protocol. When you a send a data or message, you don't know if it'll get there, it could get lost on the way. There may be corruption while transferring a message.
                                                      1. Ordered: If you send two messages out, you don't know what order they'll arrive in i.e. no ordered
                                                        1. Datagrams: Packets are sent individually and are guaranteed to be whole if they arrive. One packet per one read call.
                                                          1. Lightweight: No ordering of messages, no tracking connections, etc. It's just fire and forget! This means it's a lot quicker, and the network card / OS have to do very little work to translate the data back from the packets.
                                                            1. key facts about UDP
                                                              1. UDP Information
                                                              2. Packets
                                                                Show full summary Hide full summary

                                                                Similar

                                                                TCP Header
                                                                danhamilt1
                                                                TCP Header
                                                                danhamilt1
                                                                GCSE Maths Quiz
                                                                Andrea Leyden
                                                                HISTOGRAMS
                                                                Elliot O'Leary
                                                                AS Psychology Unit 1 - Memory
                                                                Asterisked
                                                                GCSE REVISION TIMETABLE
                                                                rebekahanne11
                                                                GCSE Maths Symbols, Equations & Formulae
                                                                livvy_hurrell
                                                                PSBD TEST # 3_1
                                                                Suleman Shah
                                                                FUNCTIONALIST ROLE OF EDUCATION
                                                                ashiana121
                                                                An Timpeallacht (Foclóir)
                                                                Sarah Egan