1 / 9

網路程式設計 (Network Programming)

網路程式設計 (Network Programming). Instructor: 陳啟彰 Office: 3506C. Socket Programming. Computer network programming 通常是指 socket programming 何謂 socket? 英文原意是 ” 插座 ” 從網路的角度來看, socket 就是通訊連結的端點 從程式設計者的角度來看, socket 提供了一個良好的介面,使程式設計者不需知道下層網路協定運作的細節便可以撰寫網路通訊程式.

mikel
Télécharger la présentation

網路程式設計 (Network Programming)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 網路程式設計(Network Programming) Instructor: 陳啟彰 Office: 3506C

  2. Socket Programming • Computer network programming • 通常是指 socket programming • 何謂socket? • 英文原意是”插座” • 從網路的角度來看,socket就是通訊連結的端點 • 從程式設計者的角度來看,socket提供了一個良好的介面,使程式設計者不需知道下層網路協定運作的細節便可以撰寫網路通訊程式

  3. Socket Programming -- cont. • Winsock • Windows Socket是以實作於Berkeley Software Distribution(BSD, release 4.3)中的UNIX sockets為基礎所發展出來的一套API • 不僅支援TCP/IP,對於 Xerox Network System (XNS),Digital Equipment Corporation's DECNet protocol,Novell Corporation's Internet Packet Exchange/Sequenced Packed Exchange(IPX/SPX) 亦可以支援

  4. Socket Programming -- cont. • Winsock • Windows Socket API是一套動態連結函式庫(DLL),即程式在編譯時期並不會和這些函式庫連結,而是等到執行期間才會呼叫這函式

  5. Socket Programming -- cont. • Javasocket programming • Java的 java.net.Socket和java.net.ServerSocket有提供TCP與UDP的socket programming • TCP, UDP程式的執行邏輯和winsock相同

  6. Sockets 的分類 • 在 TCP/IP 架構下,sockets可分為下面兩類: • Datagram sockets(connectionless) • 資料在datagram sockets間是利用UDP封包傳送,因此接收端socket可能會收到次序錯誤的資料,且其中部分資料亦可能會遺失 • Stream sockets(connection-oriented) • 資料在stream sockets間是利用TCP封包來傳送,因此接收端socket可以收到順序無誤、無重覆、正確的資料。此外TCP傳送時是採資料流的方式,因在傳送時會所有資料會視情況被分割在數個 TCP 封包中

  7. Network programming • 所有的網路應用程式皆可分為五個步驟: • 開啟一個socket • 為socket命名 • 與另一個socket結合 • 在sockets間收送資料 • 關閉socket

  8. TCP socket connection Block住,等待client 端的連線請求 連線請求 連線建立 資料傳輸

  9. UDP socket connection

More Related