該實例完成一個服務器端和客戶端簡單的會話通信過程.要求主機上安裝TCP/IP協議,并設定IP.服務器端和客戶端使用同一臺主機的不同端口號,服務器端使用的端口號為2000,客戶端使用的端口號為3000. 服務器端程序先運行,首先初始化Winsock,然后創建套接字,在2000端口上進行綁定,接著在2000端口進行偵聽,并進入等待狀態.客戶端后運行,同樣首先初始化winsock,然后創建套接字,接著嘗試和服務器端的連接.連接一旦建立,就可以在服務器端和客戶端之間進行通信.客戶端提示輸入一個數字,比如輸入50,那么客戶端會從"data0"到"data49"發送50個字符串,輸入0退出.
標簽:
IP
2000
3000
服務器
上傳時間:
2013-11-27
上傳用戶:lxm
算法ebook(10部算法經典著作的合集) 算法ebook> 10部算法經典著作的合集 chm格式 (1)Fundamentals of Data Structures by Ellis Horowitz and Sartaj Sahni (2)Data Structures, Algorithms and Program Style Using C by James F. Korsh and Leonard J. Garrett (3)Data Structures and Algorithm Analysis in C by Mark Allen Weiss (4)Data Structures: From Arrays to Priority Queues by Wayne Amsbury (5)Information Retrieval: Data Structures & Algorithms edited by William B. Frakes and Ricardo Baeza-Yates (6)Introduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson, and Ronald L. Rivest (7)Practical Data Structures in C++ by Bryan Flamig (8)Reliable Data Structures in C by Thomas Plum (9)Data Structures and Algorithms Alfred V. Aho, Bell Laboratories, Murray Hill, New Jersey John E. Hopcroft, Cornell University, Ithaca, New York Jeffrey D. Ullman, Stanford University, Stanford, California (10)DDJ Algorithms and Data Structures Articles
標簽:
ebook
Fundamentals
Structures
Ellis
上傳時間:
2015-04-04
上傳用戶:tfyt