欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
Memcache 協(xié)議(中英對照) - Doctor''s WebLog - 博樂(lè )的自留地
協(xié)議
Protocol
memcached 的客戶(hù)端使用TCP鏈接 與 服務(wù)器通訊。(UDP接口也同樣有效,參考后文的 “UDP協(xié)議” )一個(gè)運行中的memcached服務(wù)器監視一些(可設置)端口??蛻?hù)端連接這些端口,發(fā)送命令到服務(wù)器,讀取回應,最后關(guān)閉連接。Clients of memcached communicate with server through TCP connections. (A UDP interface is also available; details are below under "UDP protocol.") A given running memcached server listens on some (configurable) port; clients connect to that port, send commands to the server, read responses, and eventually close the connection.
結 束會(huì )話(huà)不需要發(fā)送任何命令。當不再需memcached服務(wù)時(shí),要客戶(hù)端可以在任何時(shí)候關(guān)閉連接。需要注意的是,鼓勵客戶(hù)端緩存這些連接,而不是每次需要 存取數據時(shí)都重新打開(kāi)連接。這是因為memcached 被特意設計成及時(shí)開(kāi)啟很多連接也能夠高效的工作(數百個(gè),上千個(gè)如果需要的話(huà))。緩存這些連接,可以消除建立連接所帶來(lái)的開(kāi)銷(xiāo)(/*/相對而言,在服務(wù)器 端建立一個(gè)新連接的準備工作所帶來(lái)的開(kāi)銷(xiāo),可以忽略不計。)。There is no need to send any command to end the session. A client may just close the connection at any moment it no longer needs it. Note, however, that clients are encouraged to cache their connections rather than reopen them every time they need to store or retrieve data. This is because memcached is especially designed to work very efficiently with a very large number (many hundreds, more than a thousand if necessary) of open connections. Caching connections will eliminate the overhead associated with establishing a TCP connection (the overhead of preparing for a new connection on the server side is insignificant compared to this).
在 memcache協(xié)議中發(fā)送的數據分兩種:文本行 和 自由數據。 文本行被用于來(lái)自客戶(hù)端的命令和服務(wù)器的回應。自由數據用于客戶(hù)端從服務(wù)器端存取數據時(shí)。同樣服務(wù)器會(huì )以字節流的方式傳回自由數據。/*/服務(wù)器不用關(guān)心 自由數據的字節順序。自由數據的特征沒(méi)有任何限制;但是通過(guò)前文提到的文本行,這項數據的接受者(服務(wù)器或客戶(hù)端),便能夠精確地獲知所發(fā)送的數據庫的長(cháng) 度。
There are two kinds of data sent in the memcache protocol: text lines
and unstructured data. Text lines are used for commands from clients
and responses from servers. Unstructured data is sent when a client
wants to store or retrieve data. The server will transmit back
unstructured data in exactly the same way it received it, as a byte
stream. The server doesn't care about byte order issues in
unstructured data and isn't aware of them. There are no limitations on
characters that may appear in unstructured data; however, the reader
of such data (either a client or a server) will always know, from a
preceding text line, the exact length of the data block being
transmitted.
文 本行固定以“\r\n”(回車(chē)符緊跟一個(gè)換行符)結束。 自由數據也是同樣會(huì )以“\r\n”結束,但是 \r(回車(chē)符)、\n(換行符),以及任何其他8位字符,均可出現在數據中。因此,當客戶(hù)端從服務(wù)器取回數據時(shí),必須使用數據區塊的長(cháng)度來(lái)確定數據區塊的 結束位置,而不要依據數據區塊末尾的“\r\n”,即使它們固定存在于此。
Text lines are always terminated by \r\n. Unstructured data is _also_
terminated by \r\n, even though \r, \n or any other 8-bit characters
may also appear inside the data. Therefore, when a client retrieves
data from a server, it must use the length of the data block (which it
will be provided with) to determine where the data block ends, and not
the fact that \r\n follows the end of the data block, even though it
does.
  
鍵值
Keys
存儲在memcached中的數據通過(guò)鍵值來(lái)標識。鍵值是一個(gè)文本字符串,對于需要存取這項數據的客戶(hù)端而言,它必須是唯一的。鍵值當前的長(cháng)度限制設定為250字符(當然,客戶(hù)端通常不會(huì )用到這么長(cháng)的鍵);鍵值中不能使用制表符和其他空白字符(例如空格,換行等)。
Data stored by memcached is identified with the help of a key. A key
is a text string which should uniquely identify the data for clients
that are interested in storing and retrieving it. Currently the
length limit of a key is set at 250 characters (of course, normally
clients wouldn't need to use such long keys); the key must not include
control characters or whitespace.
  
命令
Commands
所有命令分為3種類(lèi)型There are three types of commands.
存儲命令(有3項:’set’、’add’、’repalce’)指示服務(wù)器儲存一些由鍵值標識的數據??蛻?hù)端發(fā)送一行命令,后面跟著(zhù)數據區塊;然后,客戶(hù)端等待接收服務(wù)器回傳的命令行,指示成功與否。
Storage commands (there are three: "set", "add" and "replace") ask the
server to store some data identified by a key. The client sends a
command line, and then a data block; after that the client expects one
line of response, which will indicate success or faulure.
取 回命令(只有一項:’get’)指示服務(wù)器返回與所給鍵值相符合的數據(一個(gè)請求中右一個(gè)或多個(gè)鍵值)??蛻?hù)端發(fā)送一行命令,包括所有請求的鍵值;服務(wù)器 每找到一項內容,都會(huì )發(fā)送回客戶(hù)端一行關(guān)于這項內容的信息,緊跟著(zhù)是對應的數據區塊;直到服務(wù)器以一行“END”回應命令結束。
Retrieval commands (there is only one: "get") ask the server to
retrieve data corresponding to a set of keys (one or more keys in one
request). The client sends a command line, which includes all the
requested keys; after that for each item the server finds it sends to
the client one response line with information about the item, and one
data block with the item's data; this continues until the server
finished with the "END" response line.
/*?*/其他的命令都不能攜帶自由數據。在這些命令中,客戶(hù)端發(fā)送一行命令,然后等待(由命令所決定)一行回應,或最終以一行“END”結束的多行命令。
All other commands don't involve unstructured data. In all of them,
the client sends one command line, and expects (depending on the
command) either one line of response, or several lines of response
ending with "END" on the last line.
一行命令固定以命令名稱(chēng)開(kāi)始,接著(zhù)是以空格隔開(kāi)的參數(如果有參數的話(huà))。命令名稱(chēng)大小寫(xiě)敏感,并且必須小寫(xiě)。
A command line always starts with the name of the command, followed by
parameters (if any) delimited by whitespace. Command names are
lower-case and are case-sensitive.
  
一 些客戶(hù)端發(fā)送給服務(wù)器的命令會(huì )包含一些時(shí)限(針對內容或客戶(hù)端請求的操作)。這時(shí),時(shí)限的具體內容既可以是Unix時(shí)間戳(從1970年1月1日開(kāi)始的秒 鐘數),或當前時(shí)間開(kāi)始的秒鐘數。對后者而言,不能超過(guò) 60*60*24*30(30天);如果超出,服務(wù)器將會(huì )理解為Unix時(shí)間戳,而不是從當前時(shí)間起的秒偏移。
Some commands involve a client sending some kind of expiration time
(relative to an item or to an operation requested by the client) to
the server. In all such cases, the actual value sent may either be
Unix time (number of seconds since January 1, 1970, as a 32-bit
value), or a number of seconds starting from current time. In the
latter case, this number of seconds may not exceed 60*60*24*30 (number
of seconds in 30 days); if the number sent by a client is larger than
that, the server will consider it to be real Unix time value rather
than an offset from current time.
  
錯誤字串
Error strings
每一個(gè)由客戶(hù)端發(fā)送的命令,都可能收到來(lái)自服務(wù)器的錯誤字串回復。這些錯誤字串會(huì )以三種形式出現:Each command sent by a client may be answered with an error string
from the server. These error strings come in three types:
- "ERROR\r\n"
意味著(zhù)客戶(hù)端發(fā)送了不存在的命令名稱(chēng)。means the client sent a nonexistent command name.
- "CLIENT_ERROR <error>\r\n"
意味著(zhù)輸入的命令行里存在一些客戶(hù)端錯誤,例如輸入未遵循協(xié)議。<error>部分是人類(lèi)易于理解的錯誤解說(shuō)……means some sort of client error in the input line, i.e. the input
doesn't conform to the protocol in some way. <error> is a
human-readable error string.
- "SERVER_ERROR <error>\r\n"
意味著(zhù)一些服務(wù)器錯誤,導致命令無(wú)法執行。<error>部分是人類(lèi)易于理解的錯誤解說(shuō)。在一些嚴重的情形下(通常應該不會(huì )遇到),服務(wù)器將在發(fā)送這行錯誤后關(guān)閉連接。這是服務(wù)器主動(dòng)關(guān)閉連接的唯一情況。
means some sort of server error prevents the server from carrying
out the command. <error> is a human-readable error string. In cases
of severe server errors, which make it impossible to continue
serving the client (this shouldn't normally happen), the server will
close the connection after sending the error line. This is the only
case in which the server closes a connection to a client.
在后面每項命令的描述中,這些錯誤行不會(huì )再特別提到,但是客戶(hù)端必須考慮到這些它們存在的可能性。In the descriptions of individual commands below, these error lines
are not again specifically mentioned, but clients must allow for their
possibility.
  
存儲命令
Storage commands
首先,客戶(hù)端會(huì )發(fā)送一行像這樣的命令:First, the client sends a command line which looks like this:
<command name> <key> <flags> <exptime> <bytes>\r\n
- <command name> 是 set, add, 或者 repalce- <command name> is "set", "add" or "replace"
  • set 意思是 “儲存此數據”

  • add 意思是 “儲存此數據,只在服務(wù)器*未*保留此鍵值的數據時(shí)”

  • replace意思是 “儲存此數據,只在服務(wù)器*曾*保留此鍵值的數據時(shí)”

  • "set" means "store this data".

  • "add" means "store this data, but only if the server *doesn't* already
    hold data for this key".

  • "replace" means "store this data, but only if the server *does*
    already hold data for this key".

- <key> 是接下來(lái)的客戶(hù)端所要求儲存的數據的鍵值- <key> is the key under which the client asks to store the data
- <flags> 是在取回內容時(shí),與數據和發(fā)送塊一同保存服務(wù)器上的任意16位無(wú)符號整形(用十進(jìn)制來(lái)書(shū)寫(xiě))??蛻?hù)端可以用它作為“位域”來(lái)存儲一些特定的信息;它對服務(wù)器是不透明的。
- <flags> is an arbitrary 16-bit unsigned integer (written out in
decimal) that the server stores along with the data and sends back
when the item is retrieved. Clients may use this as a bit field to
store data-specific information; this field is opaque to the server.
- <exptime> 是終止時(shí)間。如果為0,該項永不過(guò)期(雖然它可能被刪除,以便為其他緩存項目騰出位置)。如果非0(Unix時(shí)間戳或當前時(shí)刻的秒偏移),到達終止時(shí)間后,客戶(hù)端無(wú)法再獲得這項內容。
- <exptime> is expiration time. If it's 0, the item never expires
(although it may be deleted from the cache to make place for other
items). If it's non-zero (either Unix time or offset in seconds from
current time), it is guaranteed that clients will not be able to
retrieve this item after the expiration time arrives (measured by
server time).
- <bytes> 是隨后的數據區塊的字節長(cháng)度,不包括用于分野的“\r\n”。它可以是0(這時(shí)后面跟隨一個(gè)空的數據區塊)。- <bytes> is the number of bytes in the data block to follow, *not*
including the delimiting \r\n. <bytes> may be zero (in which case
it's followed by an empty data block).
  
在這一行以后,客戶(hù)端發(fā)送數據區塊。After this line, the client sends the data block:
<data block>\r\n
- <data block> 是大段的8位數據,其長(cháng)度由前面的命令行中的<bytes>指定。- <data block> is a chunk of arbitrary 8-bit data of length <bytes>
from the previous line.
發(fā)送命令行和數據區塊以后,客戶(hù)端等待回復,可能的回復如下:After sending the command line and the data blockm the client awaits
the reply, which may be:
- "STORED\r\n"
表明成功.to indicate success.
- "NOT_STORED\r\n"
表明數據沒(méi)有被存儲,但不是因為發(fā)生錯誤。這通常意味著(zhù)add 或 replace命令的條件不成立,或者,項目已經(jīng)位列刪除隊列(參考后文的“delete”命令)。
to indicate the data was not stored, but not
because of an error. This normally means that either that the
condition for an "add" or a "replace" command wasn't met, or that the
item is in a delete queue (see the "delete" command below).
  
取回命令
Retrieval command
一行取回命令如下:The retrieval command looks like this:
get <key>*\r\n
- <key>* 表示一個(gè)或多個(gè)鍵值,由空格隔開(kāi)的字串- <key>* means one or more key strings separated by whitespace.
這行命令以后,客戶(hù)端的等待0個(gè)或多個(gè)項目,每項都會(huì )收到一行文本,然后跟著(zhù)數據區塊。所有項目傳送完畢后,服務(wù)器發(fā)送以下字串:
After this command, the client expects zero or more items, each of
which is received as a text line followed by a data block. After all
the items have been transmitted, the server sends the string
"END\r\n"
來(lái)指示回應完畢。to indicate the end of response.
服務(wù)器用以下形式發(fā)送每項內容:Each item sent by the server looks like this:
VALUE <key> <flags> <bytes>\r\n
<data block>\r\n
- <key> 是所發(fā)送的鍵名- <key> is the key for the item being sent
- <flags> 是存儲命令所設置的記號

- <flags> is the flags value set by the storage command

- <bytes> 是隨后數據塊的長(cháng)度,*不包括* 它的界定符“\r\n”- <bytes> is the length of the data block to follow, *not* including
its delimiting \r\n
- <data block> 是發(fā)送的數據- <data block> is the data for this item.
如果在取回請求中發(fā)送了一些鍵名,而服務(wù)器沒(méi)有送回項目列表,這意味著(zhù)服務(wù)器沒(méi)這些鍵名(可能因為它們從未被存儲,或者為給其他內容騰出空間而被刪除,或者到期,或者被已客戶(hù)端刪除)。
If some of the keys appearing in a retrieval request are not sent back
by the server in the item list this means that the server does not
hold items with such keys (because they were never stored, or stored
but deleted to make space for more items, or expired, or explicitly
deleted by a client).
  
刪除
Deletion
命令“delete”允許從外部刪除內容:The command "delete" allows for explicit deletion of items:
delete <key> <time>\r\n
- <key> 是客戶(hù)端希望服務(wù)器刪除的內容的鍵名- <key> is the key of the item the client wishes the server to delete
- <time> 是一個(gè)單位為秒的時(shí)間(或代表直到某一刻的Unix時(shí)間),在該時(shí)間內服務(wù)器會(huì )拒絕對于此鍵名的“add”和“replace”命令。此時(shí)內容被放入 delete隊列,無(wú)法再通過(guò)“get”得到該內容,也無(wú)法是用“add”和“replace”命令(但是“set”命令可用)。直到指定時(shí)間,這些內容 被最終從服務(wù)器的內存中徹底清除。
- <time> is the amount of time in seconds (or Unix time until which)
the client wishes the server to refuse "add" and "replace" commands
with this key. For this amount of item, the item is put into a
delete queue, which means that it won't possible to retrieve it by
the "get" command, but "add" and "replace" command with this key
will also fail (the "set" command will succeed, however). After the
time passes, the item is finally deleted from server memory.
<time>參數 是可選的,缺省為0(表示內容會(huì )立刻清除,并且隨后的存儲命令均可用)。
The parameter <time> is optional, and, if absent, defaults to 0
(which means that the item will be deleted immediately and further
storage commands with this key will succeed).
此命令有一行回應:The response line to this command can be one of:
- "DELETED\r\n"
表示執行成功to indicate success
- "NOT_FOUND\r\n"
表示沒(méi)有找到這項內容to indicate that the item with this key was not found.
參考隨后的“flush_all”命令使所有內容無(wú)效
See the "flush_all" command below for immediate invalidation
of all existing items.
  
增加/減少
Increment/Decrement
命 令 “incr” 和 “decr”被用來(lái)修改數據,當一些內容需要 替換、增加 或減少時(shí)。這些數據必須是十進(jìn)制的32位無(wú)符號整新。如果不是,則當作0來(lái)處理。修改的內容必須存在,當使用“incr”/“decr”命令修改不存在的 內容時(shí),不會(huì )被當作0處理,而是操作失敗。
Commands "incr" and "decr" are used to change data for some item
in-place, incrementing or decrementing it. The data for the item is
treated as decimal representation of a 32-bit unsigned integer. If the
current data value does not conform to such a representation, the
commands behave as if the value were 0. Also, the item must already
exist for incr/decr to work; these commands won't pretend that a
non-existent key exists with value 0; instead, they will fail.
客戶(hù)端發(fā)送命令行:The client sends the command line:
incr <key> <value>\r\n

decr <key> <value>\r\n
- <key> 是客戶(hù)端希望修改的內容的建名

- <key> is the key of the item the client wishes to change

- <value> 是客戶(hù)端要增加/減少的總數。- <value> is the amount by which the client wants to increase/decrease
the item. It is a decimal representation of a 32-bit unsigned integer.
回復為以下集中情形:

The response will be one of:

- "NOT_FOUND\r\n"
指示該項內容的值,不存在。to indicate the item with this value was not found
- <value>\r\n ,<value>是 增加/減少 。- <value>\r\n , where <value> is the new value of the item's data,
after the increment/decrement operation was carried out.
注意"decr"命令發(fā)生下溢:如果客戶(hù)端嘗試減少的結果小于0時(shí),結果會(huì )是0。"incr" 命令不會(huì )發(fā)生溢出。Note that underflow in the "decr" command is caught: if a client tries
to decrease the value below 0, the new value will be 0. Overflow in
the "incr" command is not checked.

……

Note also that decrementing a number such that it loses length isn't
guaranteed to decrement its returned length. The number MAY be
space-padded at the end, but this is purely an implementation
optimization, so you also shouldn't rely on that.
  
狀態(tài)
Statistics
命令"stats" 被用于查詢(xún)服務(wù)器的運行狀態(tài)和其他內部數據。有兩種格式。不帶參數的:
The command "stats" is used to query the server about statistics it
maintains and other internal data. It has two forms. Without
arguments:
 stats\r\n
這會(huì )在隨后輸出各項狀態(tài)、設定值和文檔。另一種格式帶有一些參數:

it causes the server to output general-purpose statistics and
settings, documented below. In the other form it has some arguments:


stats <args>\r\n
通過(guò)<args>,服務(wù)器傳回各種內部數據。因為隨時(shí)可能發(fā)生變動(dòng),本文不提供參數的種類(lèi)及其傳回數據。Depending on <args>, various internal data is sent by the server. The
kinds of arguments and the data sent are not documented in this vesion
of the protocol, and are subject to change for the convenience of
memcache developers.
  
各種狀態(tài)
General-purpose statistics
受到無(wú)參數的"stats"命令后,服務(wù)器發(fā)送多行內容,如下:Upon receiving the "stats" command without arguments, the server sents
a number of lines which look like this:
STAT <name> <value>\r\n
服務(wù)器用以下一行來(lái)終止這個(gè)清單:The server terminates this list with the line
END\r\n
在每行狀態(tài)中,<name> 是狀態(tài)的名字,<value> 使狀態(tài)的數據。 以下清單,是所有的狀態(tài)名稱(chēng),數據類(lèi)型,和數據代表的含義。
In each line of statistics, <name> is the name of this statistic, and
<value> is the data. The following is the list of all names sent in
response to the "stats" command, together with the type of the value
sent for this name, and the meaning of the value.
在“類(lèi)型”一列中,"32u"表示32位無(wú)符號整型,"64u"表示64位無(wú)符號整型,"32u:32u"表示用冒號隔開(kāi)的兩個(gè)32位無(wú)符號整型。

In the type column below, "32u" means a 32-bit unsigned integer, "64u"
means a 64-bit unsigner integer. '32u:32u' means two 32-but unsigned
integers separated by a colon.

名稱(chēng)/Name類(lèi)型/Type含義/Meaning
pid32u服務(wù)器進(jìn)程IDProcess id of this server process
uptime32u服務(wù)器運行時(shí)間,單位秒Number of seconds this server has been running
time32u服務(wù)器當前的UNIX時(shí)間current UNIX time according to the server
versionstring服務(wù)器的版本號Version string of this server
rusage_user32u:32u該進(jìn)程累計的用戶(hù)時(shí)間
(秒:微妙)
Accumulated user time for this process
(seconds:microseconds)
rusage_system32u:32u該進(jìn)程累計的系統時(shí)間
(秒:微妙)
Accumulated system time for this process
(seconds:microseconds)
curr_items32u服務(wù)器當前存儲的內容數量Current number of items stored by the server
total_items32u服務(wù)器啟動(dòng)以來(lái)存儲過(guò)的內容總數Total number of items stored by this server
ever since it started
bytes64u服務(wù)器當前存儲內容所占用的字節數Current number of bytes used by this server
to store items
curr_connections32u連接數量Number of open connections
total_connections32u服務(wù)器運行以來(lái)接受的連接總數Total number of connections opened since
the server started running
connection_structures32u服務(wù)器分配的連接結構的數量Number of connection structures allocated
by the server
cmd_get32u取回請求總數Cumulative number of retrieval requests
cmd_set32u存儲請求總數Cumulative number of storage requests
get_hits32u請求成功的總次數Number of keys that have been requested and
found present
get_misses32u請求失敗的總次數Number of items that have been requested
and not found
bytes_read64u服務(wù)器從網(wǎng)絡(luò )讀取到的總字節數Total number of bytes read by this server
from network
bytes_written64u服務(wù)器向網(wǎng)絡(luò )發(fā)送的總字節數Total number of bytes sent by this server to
network
limit_maxbytes32u服務(wù)器在存儲時(shí)被允許使用的字節總數Number of bytes this server is allowed to
use for storage.
  
其它命令
Other commands

“flush_all” 命令有一個(gè)可選的數字參數。它總是執行成功,服務(wù)器會(huì )發(fā)送“OK\r\n”回應。它的效果是使已經(jīng)存在的項目立即失效(缺?。?,或在指定的時(shí)間后。此后執 行取回命令,將不會(huì )有任何內容返回(除非重新存儲同樣的鍵名)。flush_all 實(shí)際上沒(méi)有立即釋放項目所占用的內存,而是在隨后陸續有新的項目被儲存時(shí)執行。flush_all 效果具體如下:它導致所有更新時(shí)間早于flush_all所設定時(shí)間的項目,在被執行取回命令時(shí)命令被忽略。

"flush_all" is a command with an optional numeric argument. It always succeeds, and the server sends "OK\r\n" in response. Its effect is to invalidate all existing items immediately (by default) or after the expiration specified. After invalidation none of the items will be returned in response to a retrieval command (unless it's stored again under the same key *after* flush_all has invalidated the items). flush_all doesn't actually free all the memory taken up by existing items; that will happen gradually as new items are stored. The most precise definition of what flush_all does is the following: it causes all items whose update time is earlier than the time at which flush_all was set to be executed to be ignored for retrieval purposes.
“version”命令沒(méi)有參數:"version" is a command with no arguments:
version\r\n
在回應中,服務(wù)器發(fā)送:In response, the server sends
"VERSION <version>\r\n"
<version> 是服務(wù)器的版本字串。where <version> is the version string for the server.
“quit”命令沒(méi)有參數:"quit" is a command with no arguments:
quit\r\n
接收此命令后,服務(wù)器關(guān)閉連接。不過(guò),客戶(hù)端可以在不再需要時(shí),簡(jiǎn)單地關(guān)閉連接就行,并不一定需要發(fā)送這個(gè)命令。Upon receiving this command, the server closes the connection. However, the client may also simply close the connection when it no longer needs it, without issuing this command.
  
UDP 協(xié)議
UDP protocol
當來(lái)自客戶(hù)端的連接數遠大于TCP連接的上限時(shí),可以使用基于UDP的接口。UDP接口不能保證傳輸到位,所以只有在不要求成功的操作中使用;比如被用于一個(gè)“get”請求時(shí),會(huì )因不當的緩存處理而發(fā)生錯誤或回應有遺失。For very large installations where the number of clients is high enough that the number of TCP connections causes scaling difficulties, there is also a UDP-based interface. The UDP interface does not provide guaranteed delivery, so should only be used for operations that aren't required to succeed; typically it is used for "get" requests where a missing or incomplete response can simply be treated as a cache miss.
每個(gè)UDP數據包都包含一個(gè)簡(jiǎn)單的幀頭,數據之后的內容與TCP協(xié)議的描述類(lèi)似。在執行所產(chǎn)生的數據流中,請求必須被包含在單獨的一個(gè)UDP數據包中,但是回應可能跨越多個(gè)數據包。(只有“get”和“set”請求例外,跨越了多個(gè)數據包)Each UDP datagram contains a simple frame header, followed by data in the same format as the TCP protocol described above. In the current implementation, requests must be contained in a single UDP datagram, but responses may span several datagrams. (The only common requests that would span multiple datagrams are huge multi-key "get" requests and "set" requests, both of which are more suitable to TCP transport for reliability reasons anyway.)
幀頭有8字節長(cháng),如下(均由16位整數組成,網(wǎng)絡(luò )字節順序,高位在前):The frame header is 8 bytes long, as follows (all values are 16-bit integers in network byte order, high byte first):
  • 0-1 請求ID

  • 2-3 序號

  • 4-5 該信息的數據包總數

  • 6-7 保留位,必須為0

  • 0-1 Request ID

  • 2-3 Sequence number

  • 4-5 Total number of datagrams in this message

  • 6-7 Reserved for future use; must be 0

請求ID有客戶(hù)端提供。一般它會(huì )是一個(gè)從隨機基數開(kāi)始的遞增值,不過(guò)客戶(hù)端想用什么樣的請求ID都可以。服務(wù)器的回應會(huì )包含一個(gè)和請求中的同樣的ID??蛻?hù)端使用請求ID來(lái)區分每一個(gè)回應。任何一個(gè)沒(méi)有請求ID的數據包,可能是之前的請求遭到延遲而造成的,應該被丟棄。The request ID is supplied by the client. Typically it will be a monotonically increasing value starting from a random seed, but the client is free to use whatever request IDs it likes. The server's response will contain the same ID as the incoming request. The client uses the request ID to differentiate between responses to outstanding requests if there are several pending from the same server; any datagrams with an unknown request ID are probably delayed responses to an earlier request and should be discarded.
序號的返回是從0到n-1,n是該條信息的數據包數量。The sequence number ranges from 0 to n-1, where n is the total number of datagrams in the message. The client should concatenate the payloads of the datagrams for a given response in sequence number order; the resulting byte stream will contain a complete response in the same format as the TCP protocol (including terminating \r\n sequences).
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
使用Mosh來(lái)優(yōu)化SSH連接 – 運維生存時(shí)間
DHCP技術(shù)整理版——上(基本知識點(diǎn)和典型配置)
Python和SSH:實(shí)現Linux終端的遠程連接,這個(gè)模塊你不可錯過(guò)!
WebRTC服務(wù)器理論鋪墊(四):STUN協(xié)議和STUN Header
Windows Server 2008: Domain Name System and I...
A Simple Java UDP Server and UDP Client
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久