reading-notes

Notes for Codefellows Code 401 301 201 and 102

Readings Class 12: Socket.io

Review, Research, and Discussion In your reading notes page for this class, provide answers to the following prompts. Cite any external sources

What is the benefit of transforming data into packets?

techterms A packet is a small amount of data sent over a network (compare that to quanta - as in quantum energy - smallest measure of a packet of energy - emitted by a photon), such as a LAN or the Internet. Similar to a real-life package, each packet includes a source and destination as well as the content (or data) being transferred. When the packets reach their destination, they are reassembled into a single file or other contiguous block of data. While the exact structure of a packet varies between protocols, a typical packet includes two sections — a header and payload. Information about the packet is stored in the header.

Packets are intended to transfer data reliably and efficiently. Instead of transferring a large file as a single block of data, sending smaller packets helps ensure each section is transmitted successfully. If a packet is not received or is “dropped,” only the dropped packet needs to be resent

UDP is often refereed to as a connectionless protocol. Why is this?

wiki In computer networking, the User Datagram Protocol (UDP) is one of the core members of the Internet protocol suite. With UDP, computer applications can send messages, in this case referred to as datagrams, to other hosts on an Internet Protocol (IP) network. Prior communications are not required in order to set up communication channels or data paths.

UDP uses a simple connectionless communication model with a minimum of protocol mechanisms. UDP provides checksums for data integrity, and port numbers for addressing different functions at the source and destination of the datagram. It has no handshaking dialogues, and thus exposes the user’s program to any unreliability of the underlying network; there is no guarantee of delivery, ordering, or duplicate protection. If error-correction facilities are needed at the network interface level, an application may use Transmission Control Protocol (TCP) or Stream Control Transmission Protocol (SCTP) which are designed for this purpose.

UDP is suitable for purposes where error checking and correction are either not necessary or are performed in the application; UDP avoids the overhead of such processing in the protocol stack. Time-sensitive applications often use UDP because dropping packets is preferable to waiting for packets delayed due to retransmission, which may not be an option in a real-time system

Can a socket server application have multiple socket connections?

quora Yes, you can create a server socket that can handle multiple clients simultaneously.

Can a socket connection application be connected to multiple socket servers?

stackoverflow On the client-side, it is common practice for new outbound connections to use a random client-side port, in which case it is possible to run out of available ports if you make a lot of connections in a short amount of time.

Can an application be both a socket server and a socket connection?

Yes. Eample is our lab with socket.io

Document the following Vocabulary Terms

Observer Pattern

wiki a software design pattern in which an object, named the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods.

Listener

geeksforgeeks An event listener is a procedure in JavaScript that waits for an event to occur. The simple example of an event is a user clicking the mouse or pressing a key on the keyboard.

Event Handler

webopedia a software routine that processes actions from a user such as keystrokes and mouse movements. With Web sites, event handlers make Web content dynamic.

Event Driven Programming

edgetechacademy when a program is designed to respond to user engagement in various forms. It is known as a programming paradigm in which the flow of program execution is determined by “events.” Events are any user interaction, such as a click or key press, in response to prompt from the system

Event Loop

wiki A programming contsruct or design pattern that waits and dispatches events or messages in a program. By making a request to some “event provider” then calls the relevant event handler. An Event Loop monitors the Call Stack and the Callback Queue.

Event Queue

techopedia a repository where events from an application are held prior to being processed by a receiving program or system. Event queues are often used in the context of an enterprise messaging system.

Call Stack

wiki a stack data structure that stores information about the active subroutines of a computer program.

Emit/Raise/Trigger

to start/fire a predefined event(socket.io), to start a routine

Subscribe

aws Publish/subscribe messaging, or pub/sub messaging, is a form of asynchronous service-to-service communication used in serverless and microservices architectures. In a pub/sub model, any message published to a topic is immediately received by all of the subscribers to the topic.

database

oracle an organized collection of structured information, or data, typically stored electronically in a computer system.

Preview

Skim the following materials in preparation for the upcoming lecture. Note the following as you browse the material, and be prepared to participate in discussions during lecture

Preparation Materials and Additional Resources

Videos

Read/Skim

Bookmark