This application note describes a method for developing block-oriented I/O device drivers
for applications that use the DSP/BIOS real-time kernel and includes examples that run
with Code Composer Studio v2.1 on the Texas Instruments TMS320C5402 and
TMS320C6711 DSP Starter Kits (DSKs). The device driver model presented here has
now been superceded with an updated version that supports not only block oriented
devices, but also devices such as UARTs, PCI and USB buses and Multimedia cards.
Documentation on the updated driver model as well as example drivers and source code
can be found in the Device Driver Developer s Kit product now available for download
from the TI Developer s Village.
本章專門講解編寫成功網(wǎng)絡(luò)應(yīng)用程序時(shí)所需的基本知識(shí)和A P I調(diào)用。通過(guò)上一章的學(xué)習(xí),
大家已知道從Wi n s o c k地址機(jī)和這些機(jī)器上的服務(wù),可以很容易地訪問(wèn)協(xié)議。在這一章里,
我們打算討論如何從網(wǎng)絡(luò)上的一臺(tái)機(jī)器到另一臺(tái)機(jī)器建立連接,以及如何收發(fā)數(shù)據(jù)
利用“原始套接字”(Raw Socket),我們可訪問(wèn)位于基層的傳輸協(xié)議。本章專門講解如
何運(yùn)用這種原始套接字,來(lái)模擬I P的一些實(shí)用工具,比如Tr a c e r o u t e和P i n g程序等等。使用原
始套接字,亦可對(duì)I P頭信息進(jìn)行實(shí)際的操作。本章只關(guān)心I P協(xié)議;至于如何針對(duì)其他協(xié)議使
用原始套接字,我們不打算提及。而且,大多數(shù)協(xié)議(除AT M以外)根本就不支持原始套接
字。所有原始套接字都是使用S O C K _ R AW這個(gè)套接字類型來(lái)創(chuàng)建的,而且目前只有Wi n s o c k
2提供了對(duì)它的支持。因此,無(wú)論Microsoft Windows CE 還是老版本的Windows 95 (無(wú)
Winsock 2升級(jí))均不能利用原始套接字的能力。
迄今為止,本書(shū)已介紹了可在Microsoft Wi n d o w s操作系統(tǒng)中使用的全部網(wǎng)絡(luò)A P I函數(shù)。
利用這些函數(shù),我們的應(yīng)用程序可通過(guò)網(wǎng)絡(luò),建立與其他程序的通信聯(lián)系。在那些討論中,
我們?cè)诤艽蟪潭壬蠈⒅攸c(diǎn)放在七層O S I模型的應(yīng)用層和表示層上面
本附錄介紹一些新的A P I函數(shù),有了這些函數(shù),便可在自己的計(jì)算機(jī)上對(duì)I P協(xié)議統(tǒng)計(jì)情況
進(jìn)行查詢和管理。它們有助于獲得下面的能力:
■ I p c o n f i g . e x e(或適用于微軟Windows 95的Wi n i p c f g . e x e):顯示I P配置信息,允許釋放
和更新D H C P分配的I P地址。
■ N e t s t a t . e x e:顯示T C P連接表、U D P監(jiān)聽(tīng)者表以及I P協(xié)議統(tǒng)計(jì)情況。
■ R o u t e . e x e:顯示并處理網(wǎng)絡(luò)路由表。
■ A r p . e x e:顯示并修改供“地址解析協(xié)議”(A R P)使用的I P到物理地址翻譯表。