October 2nd, 2003 01:22 AM
Basic TCP/IP and Networking
The two most commonly used protocols are Trasmission Control Protocol(TCP) and User Datagram Protocol(UDP). There are two main differences between TCP and UDP. TCP is more reliable, it lets you know what happened to the data sent. Also, its maintains a connection throughout the conversation between comuters. When data is sent through a network there is always something that may happen to it and stop it from arriving such as the computer disconnecting from the network. TCP offers a way to make sure your data has arrived, and if it hasnt arrived, it can also let you know. UDP does not offer this, it is connectionless and unreliable. Mostly UDP is used for broadcasting data across networks when you do not care who recieves it or if it has arrived sucsessfully.
There are different kinds of TCP packets. These packets are distinguished by what are called flags. Other things can be used to tell packets apart but I will only explain flags for now. The three kinds of flags I will explain are SYN, ACK, and FIN. These are the TCP flags used to open a connection between two computers. The SYN flag is used to Request A Connection, The ACK Flag is used when you ACKnowledge a request for a connection or that the data has been recieved, and a FIN flag is used to finalize a connection. Note that these are not the only kind of flags just the ones I chose to explain.
Data cant just be sent across a network raw, some things must happen between the computers sending and reciving and the data being sent. When data is getting ready to be sent the raw data goes through a kind of "packaging process". The raw data is wrapped up in a TCP/IP header. The header contains information such as the flags (SYN,ACK,FIN), The TTL (Time to live, recently changed to Hops), and Source and Destination IP along with other information. Once the data is "packaged" it is ready to be sent. First off a connection must be open. To do this, something called a Three Way Handshake[/b] must occur. It happens like this, A Computer sends a Syn Packet (Connection Request) to the computer it wishes to connect to, if the packet arrives sucsessfully then the reciving computer sends back a ACK (Acknowledge) and another SYN. Once these packets arrive, the first computer sends back a ACK and a FIN (Finalize) and the connection is made and data is ready to be sent.
Three Way Handshake
|_Computer A__| TCP(SYN) packet sent to a computer -------> |__Computer B__|
|__Computer A__| <---- TCP(ACK) Sent Back along with TCP(SYN) |__Computer B__|
|__Computer A__| Reply with TCP(ACK) and TCP(FIN) ----------> |__Computer B__|
One a connection is made data can be sent. Remember that the raw data alone is not sent, it is attached to a header containing properties about the packet and information about the connection. Data can arrive to a computer in many ways. Sometimes data will need to go through one more more routers. On the internet data will travel through more than 8 routers to get to its destination. On a small netowork this number is much smaller. A router connects two networks together. If data is sent from computer A to computer B and they are not on the same network, the data will need to go through a router. Once data is sent to a router, the router takes the data and reads the header for the destination IP. If the IP is located on that routers network the data is send to that computer. If the computer is not on a attached network the router chooses an appropiate path and sends the data to another router and it repeats this process until the specified computer recieves the data.
I hope this helps some. If this interests you and you wish to learn more about TCP/IP and networking there are alot of good tutorials already posted on AO. Also here are some links that I have found that might help. Good luck!
Thanks to Diemos for the help! (Unerror IRC)
[gloworange]And then it happened... a door opened to a world... rushing through the phone line like heroin through an addict\'s veins, an electronic pulse is sent out, a refuge from the day-to-day incompetencies is sought... a board is found. \"This is it... this is where I belong...\" I know everyone here... even if I\'ve never met them, never talked to them, may never hear from them again... I know you all...[/gloworange]