Questions What is TCP IP and UDP?**** The Transmission Control Protocol (TCP) is one of the core protocols of the Internet Protocol Suite. TCP is one of the two original components of the suite, complementing the Internet Protocol (IP), and therefore the entire suite is commonly referred to as TCP/IP.
TCP provides reliable, ordered delivery of a stream of bytes from a program on one computer to another program on another computer. TCP is the protocol used by major Internet applications such as the World Wide Web, email, remote administration and file transfer. Other applications, which do not require reliable data stream service, may use the User Datagram Protocol (UDP),
UDP provides a datagram service that emphasizes reduced latency over reliability. i.e speed is more prioritized than security here.****What is HTTP? HTTP (Hypertext Transfer Protocol) is the set of rules for transferring files (text, graphic images, sound, video, and other multimedia files) on the World Wide Web. As soon as a Web user opens their Web browser, the user is indirectly making use of HTTP. HTTP is an application protocol that runs on top of the TCP/IP suite of protocols (the foundation protocols for the Internet). HTTP is a stateless protocol In computing, a stateless protocol is a communications protocol that treats each request as an independent transaction that is unrelated to any previous request so that the communication consists of independent pairs of requests and responses. A stateless protocol does not require the server to retain session information or status about each communications partner for the duration of multiple requests. An example of a stateless protocol is the Hypertext Transfer Protocol (HTTP) which is the foundation of data communication for the World Wide Web. How can HTTP be made statefull ? One is cookies, in which case the state is sent and returned in HTTP headers. The second is URL rewriting, in which case the state is sent as part of the response and returned as part of the request URI. The third is hidden form fields, in which the state is sent to the client as part of the response, and returned to the server as part of a form’s data (which can be in the request URI or the POST body, depending on the form’s method). GET Method: 1. All the name value pairs are submitted as a query string in URL. 2. It’s not secured as it is visible in plain text format in the Location bar of the web browser. 3. As the data transfers through address bar (URL) there are some restrictions in using space, some characters like ampersand (&) etc in the GET method of posting data. We have to take special care for encoding data if such special characters are present. 4. Length of the string is restricted. 5. If method is not mentioned in the Form tag, this is the default method used. 6. If get method is used and if the page is refreshed it would not prompt before the request is submitted again. 7. One can store the name value pairs as bookmark and directly be used while sharing with others – example search results. 8. Data is always submitted in the form of text 9. If the response of the page is always same for the posted query then use GET example database searches POST Method: 1. All the name value pairs are submitted in the Message Body of the request. 2. Length of the string (amount of data submitted) is not restricted. 3. Post Method is secured because Name-Value pairs cannot be seen in location bar of the web browser. 4. If post method is used and if the page is refreshed it would prompt before the request is resubmitted. 5. If the service associated with the processing of a form has side effects (for example, modification of a database or subscription to a service), the method should be POST. 6. Data is submitted in the form as specified in enctype attribute of form tag and thus files can be used in FileUpload input box. Methods of HTTP HTTP defines nine methods (sometimes referred to as “verbs”) indicating the desired action to be performed on the identified resource. What this resource represents, whether pre-existing data or data that is generated dynamically, depends on the implementation of the server. Often, the resource corresponds to a file or the output of an executable residing on the server. HEAD **Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content. **GET **Requests a representation of the specified resource. Requests using GET should only retrieve data and should have no other effect. (This is also true of some other HTTP methods.) The W3C has published guidance principles on this distinction, saying, “Web application design should be informed by the above principles, but also by the relevant limitations.” **POST **Submits data to be processed (e.g., from an HTML form) to the identified resource. The data is included in the body of the request. This may result in the creation of a new resource or the updates of existing resources or both. **PUT **Uploads a representation of the specified resource. **DELETE **Deletes the specified resource. **TRACE **Echoes back the received request, so that a client can see what (if any) changes or additions have been made by intermediate servers. **OPTIONS **Returns the HTTP methods that the server supports for specified URL. This can be used to check the functionality of a web server by requesting ‘*’ instead of a specific resource. **CONNECT **Converts the request connection to a transparent TCP/IP tunnel, usually to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy. **PATCH **Is used to apply partial modifications to a resource. HTTP servers are required to implement at least the GET and HEAD methods and, whenever possible, also the OPTIONS method. Some methods (for example, HEAD, GET, OPTIONS and TRACE) are defined as safe** Socket Programming Socket Programming is a technique through which we establish communication between client and server. What is IP? An Internet Protocol address (IP address) is a numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet Protocol for communication. An IP address serves two principal functions: host or network interface identification and location addressing. Its role has been characterized as follows: “A name indicates what we seek. An address indicates where it is. A route indicates how to get there.”