freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于udp網(wǎng)絡(luò)通信系統(tǒng)的服務(wù)端程序設(shè)計(jì)課程設(shè)計(jì)報告-資料下載頁

2025-08-17 15:10本頁面

【導(dǎo)讀】理解UDP協(xié)議的基本功能和工作原理。培養(yǎng)運(yùn)用理論知識解決實(shí)際問題的能力。理解UDP協(xié)議在Java編程語言中的具體體現(xiàn)。運(yùn)用所學(xué)的知識,學(xué)會分析程序,并從實(shí)際上實(shí)現(xiàn)即時通訊的要求。網(wǎng)絡(luò)聊天已經(jīng)成為人們工作生活中傳遞信息、交流感情的重要工具,給。本課題是開發(fā)一個基于UDP的局域網(wǎng)聊天系統(tǒng),運(yùn)用。服務(wù)器連接,客戶端與客戶端之間通過UDP互相通訊。其重要性更是不可估量。本課程設(shè)計(jì)將基于UDP. UDP有不提供數(shù)據(jù)包分組、組裝和不能對數(shù)據(jù)包進(jìn)行排序的缺點(diǎn),今天UDP仍然不失為一項(xiàng)非常實(shí)用和可行的網(wǎng)絡(luò)傳輸層協(xié)議。UDP協(xié)議基本上是IP協(xié)議與上層協(xié)議的接口。UDP協(xié)議的主要作用是將網(wǎng)絡(luò)數(shù)據(jù)流量壓縮成數(shù)據(jù)包的形式。UDP是面向報文的。發(fā)送方的UDP對應(yīng)程序交下來的報文,在添加首部后就。UDP包頭由4個域組成,其中每個域各占用2個字節(jié)。目標(biāo)端口號(16位):UDP數(shù)據(jù)包的接收方使用的端口號。端口號為不同的應(yīng)用保留其各自的數(shù)據(jù)傳輸通道。UDP和rap協(xié)議正是采用這一

  

【正文】 public class SimpleServer extends Thread{ private static final int DEFAULT_PORT = 6666。 private static final String DEFAULT_FILE_NAME = 。 private Socket socket。 public SimpleServer(Socket socket){ = socket。 start()。 } @Override public void run() { (Connected from + ())。 try { BufferedReader in = new BufferedReader( new InputStreamReader(()))。 網(wǎng)絡(luò)協(xié)議編程課程設(shè)計(jì) 第 27 頁 共 31 頁 PrintWriter out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(())), true)。 String inputLine, outputLine。 HandleInput handleInput = new HandleInput()。 outputLine = (null)。 (outputLine)。 while((inputLine = ()) != null){ outputLine = (inputLine)。 (outputLine)。 ()。 if((bye)) break。 if((password:valid)){ //prepare for the transmission of the file (2020)。 InputStream fileInput = new FileInputStream(new File(DEFAULT_FILE_NAME))。 OutputStream fileOutput = new DataOutputStream( new BufferedOutputStream(()))。 byte[] buf = new byte[2048]。 //transmit the file int num = (buf)。 while(num != 1){ (buf, 0, num)。 網(wǎng)絡(luò)協(xié)議編程課程設(shè)計(jì) 第 28 頁 共 31 頁 ()。 num = (buf)。 } ()。 ()。 } } ()。 ()。 (Disconnected from + ())。 ()。 } catch (IOException e) { // TODO Autogenerated catch block ()。 } catch (InterruptedException e) { // TODO Autogenerated catch block ()。 } } private class HandleInput{ private Map userInfo = new HashMap()。 private String username = 。 private String password = 。 public HandleInput(){ 網(wǎng)絡(luò)協(xié)議編程課程設(shè)計(jì) 第 29 頁 共 31 頁 (me, me)。 (abc, abc)。 (123, 123)。 } public String handle(String input){ String output = 。 if(input == null) output = Hi。 else if((username)){ username = (:)[1]。 if((username)) output = username:valid。 else output = username:invalid。 }else if((password)){ password = (:)[1]。 if((username).equals(password)) output = password:valid。 else output = password:invalid。 }else if((bye)){ output = bye。 } return output。 } } public static void main(String[] args) { 網(wǎng)絡(luò)協(xié)議編程課程設(shè)計(jì) 第 30 頁 共 31 頁 int port = DEFAULT_PORT。 if( 0){ port = (args[0])。 } try { ServerSocket serverSocket = new ServerSocket(port)。 (Server Started)。 try { while(true){ Socket theSocket = ()。 try { new SimpleServer(theSocket)。 } catch (Exception e) { ()。 ()。 } } } catch (Exception e) { // TODO: handle exception ()。 } finally { if(serverSocket != null) ()。 } } catch (IOException e) { // TODO Autogenerated catch block 網(wǎng)絡(luò)協(xié)議編程課程設(shè)計(jì) 第 31 頁 共 31 頁 ()。 } } }
點(diǎn)擊復(fù)制文檔內(nèi)容
高考資料相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1