Copyright© 2004 Sergiu Dumitriu, Marta Gî rdea, Că tă lin Hriţ cu Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License" All brand names, product names, or trademarks belong to their respective holders.
標簽:
Permission
Copyright
259
Dumitriu
上傳時間:
2015-04-02
上傳用戶:jackgao
該實例完成一個服務器端和客戶端簡單的會話通信過程.要求主機上安裝TCP/IP協議,并設定IP.服務器端和客戶端使用同一臺主機的不同端口號,服務器端使用的端口號為2000,客戶端使用的端口號為3000. 服務器端程序先運行,首先初始化Winsock,然后創建套接字,在2000端口上進行綁定,接著在2000端口進行偵聽,并進入等待狀態.客戶端后運行,同樣首先初始化winsock,然后創建套接字,接著嘗試和服務器端的連接.連接一旦建立,就可以在服務器端和客戶端之間進行通信.客戶端提示輸入一個數字,比如輸入50,那么客戶端會從"data0"到"data49"發送50個字符串,輸入0退出.
標簽:
IP
2000
3000
服務器
上傳時間:
2013-11-27
上傳用戶:lxm