This article is about the PHP surface of the question two of the use of the transmission protocol, has a certain reference value, now share to everyone, the need for friends can refer to
1.HTTP (Hyper Text Transport Protocol): Hypertext Transfer Protocol. It is one of the most widely used communication protocols on the Internet, and the WWW program used by internet users is required to abide by this Protocol standard. If a user wants to access a file on a resource server, including browsing, downloading, running, and so on, the specified files on that server can access the resources of WWW on the Internet via HTTP.
2. File: Local files Transfer Protocol. is a way to get files from a user's own computer, through which users can display files saved on their hard drive on the navigation system screen.
3. FTP (File Transfer Protocol): Files Transfer Protocol. This protocol is one of the ways to get files from the Internet, which transfers files between users and file servers. This protocol allows users to easily view the contents of a file on a remote server, while also copying the required content to the computer they are using. On the other hand, if the file server authorization allows users to manage the files on the server, users can upload the contents of their local computer to the file server, let other users share, and also be free to edit the above files, such as delete, move, copy, Name change and so on.
The transport layer provides two ways to reach the target network
Transmission Control Protocol (TCP): Provides sophisticated error control and traffic controls to ensure normal data transmission and is a connection-oriented protocol.
User Datagram Protocol (UDP): Provides only basic error detection and is a non-connected protocol.
Characteristics:
1) UDP:
Package the data
Limited data size (64k)
Do not establish a connection
Fast, but low reliability
2) TCP:
Establishing a connection Channel
Unlimited data size
Slow, but high reliability
Because the transport layer involves a lot of things, such as ports, sockets, etc., are we do mobile development needs to understand, after the article we then specifically introduced, here will not explain.
The application layer is the highest level of the TCP/IP protocol and is the most accessible for our mobile development.
Protocols that run on the TCP protocol:
HTTP (hypertext Transfer Protocol, Hypertext Transfer Protocol), mainly used for general browsing.
HTTPS (hypertext Transfer Protocol over secure Socket Layer, or HTTP over SSL, Secure Hypertext Transfer Protocol), secure version of HTTP protocol.
FTP (file Transfer, Protocol, Files Transfer Protocol), used for file transfer by name.
POP3 (Post Office Protocol, version 3, Post Office Protocol), receive mail.
SMTP (Simple Mail Transfer Protocol), which is used to send e-mail messages.
TELNET (teletype over the network, net telex), log in via a terminal (terminal) to the network.
SSH (Secure Shell, used to replace the poor security of Telnet), for encrypted secure login.
Protocols that run on the UDP protocol:
BOOTP (boot Protocol, boot protocol), applied to diskless devices.
The NTP (Network time Protocol, the Internet Protocol) is used for network synchronization.
DHCP (Dynamic Host configuration Protocol, dynamically configured protocol), dynamically configure IP addresses.
Other:
DNS (domain Name Service), which is used to complete address lookups, mail forwarding, and so on (running on TCP and UDP protocols).
Echo (Echo Protocol, wrap-around protocol) for error detection and measurement response time (running on TCP and UDP protocols).
SNMP (Simple network Management Protocol), which is used for network information collection and network management.
ARP, Address Resolution Protocol, addresses resolution protocol for dynamic resolution of Ethernet hardware addresses.
SIP protocol https://www.cnblogs.com/gardenofhu/p/7299963.html
Session Initiation Protocol (SIP) is one of the most commonly used protocols in VoIP technology. It is an application-layer protocol that works in conjunction with other application-layer protocols to control multimedia communication sessions over the Internet.
SIP-Overview
Here are a few things to consider about SIP-
SIP is a signaling protocol used to create, modify, and terminate multimedia sessions over an Internet protocol. A session is just a simple call between two endpoints. Endpoints can be smart phones, laptops or any device that can receive and send multimedia content over the Internet.
SIP is an application-layer protocol defined by the IETF (Internet Engineering Task force) standard. It is defined in RFC 3261.
SIP embodies the client-server architecture, as well as the URLs and URIs that use HTTP and URLs, as well as the text encoding scheme and header style of SMTP.
SIP uses the help of the SDP (Session Description Protocol), which describes the session and RTP (real-time transport protocol) used to deliver voice and video over an IP network.
SIP can be used for both parties (unicast) or multiparty (multicast) sessions.
Other SIP applications include file transfer, instant messaging, video conferencing, online gaming, and streaming multimedia distribution.
Describes the applicability of SIP in general scenarios-
Typically, the SIP protocol is used for Internet telephony and multimedia distribution between two or more endpoints. For example, a person can use SIP to initiate a phone call to another person, or someone can set up a conference call with many participants.
The SIP protocol is designed to be very simple, with limited command configuration. It is also text-based, so anyone can read SIP messages passed between endpoints in a SIP session.
There are entities that help SIP to create its network. In sip, each network element is identified by a SIP URI (Uniform Resource Identifier), which is like an address. The following are the network elements-
User Agent
Proxy Server
Registering a server
REDIRECT Server
Location server
User Agent
It is the endpoint of the SIP network and one of the most important network elements. The endpoint can start, modify, or terminate the session. A user agent is the most intelligent device or network component in a SIP network. It can be a soft phone, a mobile phone or a laptop computer.
The user agent is logically divided into two parts-
User Agent Client (UAC)-the entity that sends the request and receives the response.
User Proxy Server (UAS)-the entity that receives the request and sends the response.
SIP is based on a client-server architecture in which the caller's phone acts as the client initiating the call, and the called Party's phone acts as the server that responds to the call.
Proxy Server
A network element receives a request from a user agent and forwards it to another user.
Basically the proxy server acts like a router.
It has some intelligence to understand the SIP request and send it with the help of the URI.
A proxy server is located between two user agents.
There can be a maximum of 70 proxy servers between the source and destination.
There are two types of proxy servers-
Stateless proxy Server-it simply forwards the received message. This type of server does not store any call or transaction information.
Stateful Proxy Server-this type of proxy server can track every request and response received, and can use it in the future if needed. If the other party does not respond, it can resend the request.
Registering a server
The registration server accepts the registration request from the user agent. It can help users authenticate to the network. It stores the URI and the user's location in the database to help other SIP servers within the same domain.
Take a look at the following example, which shows the process of SIP registration.
Here the caller wants to register with the TMC domain. Therefore, it sends a register request to the TMC's registrar server, and the server returns a $ OK response when the client is authorized.
REDIRECT Server
The redirect server receives the request and finds the intended recipient of the request in the location database that the Registrar creates.
The redirect server uses the database to obtain location information and responds to the user with a 3xx (redirected response). We'll discuss the response code later in this tutorial.
Location server
The location server provides information about the possible location of callers to redirects and proxy servers.
Only the proxy server or the redirection server can contact the location server.
Depicts the role that each network element plays in establishing a session.
SIP-System Architecture
SIP is constructed as a layered protocol, which means that its behavior is described in terms of a fairly independent set of processing stages, with only loose coupling between each phase.
The lowest layer of SIP is its syntax and encoding. Its encoding is specified using the Enhanced Backus-naur table Syntax (BNF).
The second layer is the transport layer. It defines how the client sends the request and receives the response, and how the server receives the request and sends the response over the network. All SIP elements contain transport layers.
Next is the transaction layer. A transaction is a request sent to a server transaction by a client transaction (using the Transport layer), and all responses to the request are sent back to the client from the server transaction. Any tasks completed by the User Agent client (UAC) will be performed using a series of transactions. A stateless proxy does not contain a transaction layer.
The layer above the transaction layer is called the transactional user. In addition to stateless proxies, each SIP entity is a transactional user.
Shows the basic call flow for a SIP session.
The following is a step-up description of the call process above-
The invite request sent to the proxy server is responsible for initiating the session.
The proxy server sends 100 attempts to immediately respond to the caller (Alice) to stop the resend of the invite request.
The proxy server searches for the address of Bob in the location server. After obtaining the address, forward the invite request further.
After that, Bob's phone generated a 180 ringing (temporary response) back to Alice.
Bob picks up the phone and a quick response is generated.
Once the OK arrives Alice,bob receives an ACK from Alice.
At the same time, the session is established, and the RTP packets (sessions) Start flowing from both ends.
After the session ends, any participant (Alice or Bob) can send a bye request to terminate the session.
Bye bypasses the proxy server directly from Alice to Bob.
Finally, Bob sends a OK response to confirm the bye and the session terminates.
In the basic call flow above, you can use three transactions (marked as three-in-one).
A full call (from invite to OK) is called a conversation dialog.
SIP trapezoid
How does an agent help one user connect with another user? Let us find out with the help of.
The topology shown in the figure is called the SIP ladder diagram. The process occurs as follows-
When a caller initiates a call, a invite message is sent to the proxy server. After the proxy server receives the invite, it attempts to resolve the address of the assignee with the DNS server.
After the next route is obtained, the caller's proxy server (proxy 1, also known as the outbound proxy server) forwards the invite request to the callee's proxy server as the callee's inbound proxy (proxy server 2).
The inbound proxy server contacts the location server to get the called party address information registered by the user.
After the information is obtained from the location server, the call is forwarded to its destination.
Once the user agent knows their address, they can bypass the call, i.e. direct call.
There are two types of SIP messages-request and response.
The start line of the request contains the method that defines the request, and the request URI that defines the request to be sent.
Similarly, the start line of the response contains the response code.
Request method
A SIP request is the code used to establish communication. To complement them, SIP responses usually indicate whether the request was successful or failed.
These SIP requests, known as methods, make SIP messages feasible.
Methods can be considered SIP requests because they request specific actions taken by another user agent or by the server.
Methods are divided into two types-
Core approach
Extension methods
Core approach
There are six core approaches, as described below.
Invited
Invite is used to start a session with a user agent. In other words, the Invite method is used to establish a media session between user agents.
Invite can include the calling party's media information in the message body.
If the invite has received a successful response (2XX) or has sent an ACK, the session is considered to be established.
A successful Invite request establishes a dialog between two user agents until the bye is sent to terminate the session.
The INVITE that are sent within the established dialog box is called Re-invite.
The re-invite is used to change the session characteristics or refresh the state of the dialog box.
Invitation Example
The following code shows how invite is used.
Copy Code
INVITE sips:bob@tmc.com sip/2.0 via:sip/2.0/tls client. Anc.com:5061;branch = z9hg4bk74bf9 max-forwards:70 from:alicesips:alice@ttp.com;tag = 1234567 to : bobsips:bob@tmc.com call-id:12345601@192.168.2.1 cseq:1 INVITE contact:sips:alice@client.anc.com Allow:invite, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY Supported:replaces CONTENT-TYPE:APPLICATION/SDP content-length: ... v = 0 o = Alice 2890844526 2890844526 In IP4 client. anc.com s = Session SDP c = in IP4 client. anc.com t = 3034423619 0 m = audio 49170 RTP/AVP 0 a = rtpmap:0 pcmu/8000
Copy Code
BYE BYE is the method used to terminate a given session. This is a SIP request that can be sent by the caller or the called party to terminate the session. It cannot be sent by a proxy server. Bye requests are usually routed end-to-end, bypassing the proxy server. Bye cannot be sent to a pending invite or non-established session. Registers register requests to perform the registration of the user agent. The request is sent by the user agent to the registration server. The register request can be forwarded or proxied until it reaches the authoritative registrar for the specified domain. It carries AOR (record address) in the to header of the user being registered. The register request contains a time period (3600sec). One user agent can send a register request on behalf of another user agent. This is called a third-party registration. Here, the from tag contains the URI representing the party who submitted the registration as identified in the to heading. Cancel cancels to terminate the session that was not established. The user agent uses this request to cancel a pending call attempt that was previously initiated. It can be sent by a user agent or a proxy server. Cancel is a hop-by-step request, that is, it passes the element between the user agent and receives the response generated by the next stateful element. Ack ack is used to confirm the final response to the invite method. If invite is not available, the ACK always contains the SDP body (media attribute) along the invite.ack direction. The ACK may not be used to modify the media description that has been sent in the initial invite. The stateful proxy that receives an ACK must determine that the ACK should be forwarded downstream to another proxy or user agent. For a 2xx response, the ACK is end-to-end, but for all other final responses, it is based on hop-on work when the stateful proxy is involved. The options options method is used to ask the user agent or proxy server for its functionality and discover its current availability. The response to the request lists the functionality of the user agent or server. The agent never generates an options request.
Extension methods
Subscription
The user agent uses Subscribe to establish a subscription to get notifications about a specific event.
It contains a Expires header field that indicates the duration of the subscription.
After the deadline, the subscription is automatically terminated.
The subscription establishes a dialog between the user agents.
You can re-subscribe by sending another subscribe within the dialog box before the expiration time.
Users will receive a $ OK subscription.
The user can use the Expires value 0 (0) to send another subscribe method to cancel the subscription.
Notice
The user agent uses notify to get the occurrence of a particular event. Typically, when a subscription exists between a subscriber and a notifier, notify fires within the dialog box.
If the notifier receives, each notify will receive a $ OK response.
Notify contains the event header field that indicates the event and the Subscriptionstate header field that indicates the current state of the subscription.
Always send notify at the beginning and end of a subscription.
Release
Publish is used by the user agent to send event status information to the server.
Publish is useful when there is more than one source of event information.
The publish request is similar to notify, except that it is not sent in the dialog box.
The publish request must contain the Expires header field and the Min-expires header field.
Reference
Refer the URI that is used by the user agent to refer to another user agent to access the dialog box.
Refer must contain refer-to headings. This is a mandatory title for refer.
Refer can be sent inside or outside the dialog box.
A 202 accepted will trigger a refer request indicating that another user agent has accepted the reference.
Information
Info is used by the user agent to send call signaling information to another user agent for which it has established a media session.
This is an end-to-end request.
The agent will always forward an info request.
UPDATE
If the session is not established, update is used to modify the state of the session. The user can use the update to adapt the decoder.
If the session is established, use a re-invite to change/update the session.
Prack
The prack is used to confirm receipt of a reliable transient response transfer (1XX).
In general, Prack is generated by the client when it receives a temporary response containing the RSEQ reliable serial number and Supported:100rel header.
The Prack contains (rseq + cseq) values in the race header.
The Prack method applies to all temporary responses, except that 100 tries to respond, which is never reliable for shipping.
Prack may contain the body of the message; It can be used to provide/reply to an interchange.
Information
It is used to send instant messages using SIP. Im is usually a short message exchanged in real time by participants in a text session.
The message can be sent outside the dialog box or out of the dialog box.
The contents of the message are loaded as MIME attachments in the message body.
A $ ok is normally received in response to indicate that the message has been delivered at its destination.