程式設計練習生的第13天(網路程式設計詳解)

2021-09-25 09:31:31 字數 1563 閱讀 6410

網路程式設計

/*

public class spiderdemo04 

//關閉

read.close();

}}

/*

* 模擬瀏覽器爬蟲

* * 寫出到檔案中io-->輸出流

*/public class spiderdemo05

//關閉

read.close();

}}

面向socket程式設計

1.定義傳送端 datagramsocket(埠號) 指定傳送端的埠號

2.準備資料

3.對資料打包 datagrampacket(byte buf, int offset, int length, inetaddress address, int port)

構造資料報包,用來將長度為 length 偏移量為 offset 的包傳送到指定主機上的指定埠號。

4.傳送void send(datagrampacket p)

5.關閉 void close() 關閉此資料報套接字。

public class udpsend01 

}

接收端

public static void main(string args) throws ioexception
客戶端

public static void main(string args) throws unknownhostexception, ioexception 

}

伺服器端

public static void main(string args) throws ioexception
tcp實現上傳檔案

public static void main(string args) throws unknownhostexception, ioexception 

//刷出

out.flush();

//關閉

out.close();

is.close();

socket.close();

}

tcp實現上傳檔案服務端

public static void main(string args) throws ioexception 

//5.刷出

out.flush();

//5.關閉

out.close();

read.close();

socket.close();

server.close();

·													2019.07.19

程式設計練習生的第24天! html

什麼是 html?html 語言用於描述網頁。html 是指超文字標記語言 hyper text markup language html 不是一種程式語言,而是一種標記語言 標記語言是一套標記標籤 markup tag html 使用標記標籤來描述網頁 html 文件包含了html 標籤及文字內容...

準大一的IT練習生

這個作業屬於哪個課程 這個作業要求在 homework 11113 這個作業的目標 了解並學習github和的使用以及自我介紹 自我介紹 作為乙個略有些靦腆的人,我認為軟體工程是乙個適合我的性格來選擇的專業,同時我也認為這個專業會有乙個良好的前景和未來。我的家人能為我的這個選擇提供一定的幫助和支援,...

程式設計練習生的第七天

容器 容器的遍歷 collection 增強for for string s col 迭代器 iterator iterator 返回在此 collection 的元素上進行迭代的迭代器。凡是collection實現類的物件都能呼叫iterator獲取操作當前這個容器物件的迭代器 1 獲取迭代器物件...