java技術(shù)(外文文獻(xiàn)翻譯).doc
約20頁DOC格式手機(jī)打開展開
java技術(shù)(外文文獻(xiàn)翻譯),網(wǎng)絡(luò)編程歷史上的網(wǎng)絡(luò)編程都傾向于困難、復(fù)雜,而且極易出錯(cuò)。程序員必須掌握與網(wǎng)絡(luò)有關(guān)的大量細(xì)節(jié),有時(shí)甚至要對硬件有深刻的認(rèn)識。一般地,我們需要理解連網(wǎng)協(xié)議中不同的“層”(layer)。而且對于每個(gè)連網(wǎng)庫,一般都包含了數(shù)量眾多的函數(shù),分別涉及信息塊的連接、打包和拆包;這些塊的來回運(yùn)輸;以及握手等等。這是一項(xiàng)令人痛苦的工作。...
內(nèi)容介紹
此文檔由會員 wanli1988go 發(fā)布
網(wǎng)絡(luò)編程
歷史上的網(wǎng)絡(luò)編程都傾向于困難、復(fù)雜,而且極易出錯(cuò)。
程序員必須掌握與網(wǎng)絡(luò)有關(guān)的大量細(xì)節(jié),有時(shí)甚至要對硬件有深刻的認(rèn)識。一般地,我們需要理解連網(wǎng)協(xié)議中不同的“層”(Layer)。而且對于每個(gè)連網(wǎng)庫,一般都包含了數(shù)量眾多的函數(shù),分別涉及信息塊的連接、打包和拆包;這些塊的來回運(yùn)輸;以及握手等等。這是一項(xiàng)令人痛苦的工作。
Java最出色的一個(gè)地方就是它的“無痛苦連網(wǎng)”概念。有關(guān)連網(wǎng)的基層細(xì)節(jié)已被盡可能地提取出去,并隱藏在JVM以及Java的本機(jī)安裝系統(tǒng)里進(jìn)行控制。我們使用的編程模型是一個(gè)文件的模型;事實(shí)上,網(wǎng)絡(luò)連接(一個(gè)“套接字”)已被封裝到系統(tǒng)對象里,所以可象對其他數(shù)據(jù)流那樣采用同樣的方法調(diào)用。除此以外,在我們處理另一個(gè)連網(wǎng)問題——同時(shí)控制多個(gè)網(wǎng)絡(luò)連接——的時(shí)候,Java內(nèi)建的多線程機(jī)制也是十分方便的。
Network programming
Historically, programming across multiple machines has been error-prone, difficult, and complex.
The programmer had to know many details about the network and sometimes even the hardware. You usually needed to understand the various “l(fā)ayers” of the networking protocol, and there were a lot of different functions in each different networking library concerned with connecting, packing, and unpacking blocks of information; shipping those blocks back and forth; and handshaking. It was a daunting task.
One of Java’s great strengths is painless networking. The Java network library designers have made it quite similar to reading and writing files, except that the “file” exists on a remote machine and the remote machine can decide exactly what it wants to do about the information you’re requesting or sending. As much as possible, the underlying details of networking have been abstracted away and taken care of within the JVM and local machine installation of Java. The programming model you use is that of a file; in fact, you actually wrap the network connection (a “socket”) with stream objects, so you end up using the same method calls as you do with all other streams. In addition, Java’s built-in multithreading is exceptionally handy when dealing with another networking issue: handling multiple connections at once.
歷史上的網(wǎng)絡(luò)編程都傾向于困難、復(fù)雜,而且極易出錯(cuò)。
程序員必須掌握與網(wǎng)絡(luò)有關(guān)的大量細(xì)節(jié),有時(shí)甚至要對硬件有深刻的認(rèn)識。一般地,我們需要理解連網(wǎng)協(xié)議中不同的“層”(Layer)。而且對于每個(gè)連網(wǎng)庫,一般都包含了數(shù)量眾多的函數(shù),分別涉及信息塊的連接、打包和拆包;這些塊的來回運(yùn)輸;以及握手等等。這是一項(xiàng)令人痛苦的工作。
Java最出色的一個(gè)地方就是它的“無痛苦連網(wǎng)”概念。有關(guān)連網(wǎng)的基層細(xì)節(jié)已被盡可能地提取出去,并隱藏在JVM以及Java的本機(jī)安裝系統(tǒng)里進(jìn)行控制。我們使用的編程模型是一個(gè)文件的模型;事實(shí)上,網(wǎng)絡(luò)連接(一個(gè)“套接字”)已被封裝到系統(tǒng)對象里,所以可象對其他數(shù)據(jù)流那樣采用同樣的方法調(diào)用。除此以外,在我們處理另一個(gè)連網(wǎng)問題——同時(shí)控制多個(gè)網(wǎng)絡(luò)連接——的時(shí)候,Java內(nèi)建的多線程機(jī)制也是十分方便的。
Network programming
Historically, programming across multiple machines has been error-prone, difficult, and complex.
The programmer had to know many details about the network and sometimes even the hardware. You usually needed to understand the various “l(fā)ayers” of the networking protocol, and there were a lot of different functions in each different networking library concerned with connecting, packing, and unpacking blocks of information; shipping those blocks back and forth; and handshaking. It was a daunting task.
One of Java’s great strengths is painless networking. The Java network library designers have made it quite similar to reading and writing files, except that the “file” exists on a remote machine and the remote machine can decide exactly what it wants to do about the information you’re requesting or sending. As much as possible, the underlying details of networking have been abstracted away and taken care of within the JVM and local machine installation of Java. The programming model you use is that of a file; in fact, you actually wrap the network connection (a “socket”) with stream objects, so you end up using the same method calls as you do with all other streams. In addition, Java’s built-in multithreading is exceptionally handy when dealing with another networking issue: handling multiple connections at once.