Jupyter(Server):
server_data = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_data.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
#作業系統會在伺服器socket被關閉或伺服器程序終止後馬上釋放該伺服器的埠,否則作業系統會保留幾分鐘該埠。
server_data.bind((HOST, data_port))
server_data.listen(5)
Client端跟Serv er要做socket連線時
出現[WinError 10049] 內容中所要求的位址不正確
原因是因为bind中的IP不能随意写
cmd.exe 命令提示字元
輸入指令 ipconfig/all:
![Python socket連線出現[WinError 10049] 內容中所要求的位址不正確 cmd.exe: ipconfig/all ; TCP/IPv4 vs IPv6 - 儲蓄保險王](https://savingking.com.tw/wp-content/uploads/2022/10/20221028151556_42.png)
ip位址:
192.168.196.26
自己連自己
若client端連不上
這裡試試看:
![Python socket連線出現[WinError 10049] 內容中所要求的位址不正確 cmd.exe: ipconfig/all ; TCP/IPv4 vs IPv6 - 儲蓄保險王](https://savingking.com.tw/wp-content/uploads/2022/10/20221028153001_51-1200x704.png)
通訊協定第4版(IPv4),
不要選到第6版(IPv6)
IPv4和IPv6都是網際網路協議,用於識別網路上的設備。IPv4使用32位元位址,而IPv6使用128位元位址,因此IPv6可以提供更多的位址空間,並支援更多的設備連線到網路。此外,IPv6還提供了更好的安全性、更高的速度和更好的QoS(服務品質)。
儘管IPv6具有許多優點,但目前IPv4仍然是網際網路中使用最廣泛的協議。這是因為IPv4已經被廣泛採用,而IPv6的部署仍在進行中。如果您的網路基礎設施支援IPv6,那麼您可以使用IPv6來獲得更好的性能和安全性。否則,IPv4仍然是您最好的選擇。
推薦hahow線上學習python: https://igrape.net/30afN
![Python: pandas.DataFrame()處理雙維度資料,dict跟2D list轉為DataFrame有何差別?如何用index及columns屬性客製化index跟欄位名稱?df.index = [“一”,”二”,”三”,”四”] ; df.columns = 使用.head(n) ; .tail(m) ;取首n列,尾m列; .at[index,欄位名稱] 取單一資料 ; .iat[index,欄位順序] 取單一資料 ; .loc[index,欄位名稱] 取資料 ; .iloc[index,欄位順序];df.iloc[ [0,1],[0,2]])取資料 ; df.iloc[ 0:3,0:2]切片 Python: pandas.DataFrame()處理雙維度資料,dict跟2D list轉為DataFrame有何差別?如何用index及columns屬性客製化index跟欄位名稱?df.index = [“一”,”二”,”三”,”四”] ; df.columns = 使用.head(n) ; .tail(m) ;取首n列,尾m列; .at[index,欄位名稱] 取單一資料 ; .iat[index,欄位順序] 取單一資料 ; .loc[index,欄位名稱] 取資料 ; .iloc[index,欄位順序];df.iloc[ [0,1],[0,2]])取資料 ; df.iloc[ 0:3,0:2]切片](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2022/11/20221111093547_79.png?quality=90&zoom=2&ssl=1&resize=350%2C233)



![Python: 如何使用functools.reduce逐步縮減可迭代對象,合併為單個結果? import functools; product = functools.reduce( lambda x, y: x * y, numbers) ; reduce(function, sequence [, initial]) -> value ; map(function, iterable) ; filter(function, iterable) ; map ; filter Python: 如何使用functools.reduce逐步縮減可迭代對象,合併為單個結果? import functools; product = functools.reduce( lambda x, y: x * y, numbers) ; reduce(function, sequence [, initial]) -> value ; map(function, iterable) ; filter(function, iterable) ; map ; filter](https://i0.wp.com/savingking.com.tw/wp-content/uploads/2023/06/20230626093403_49.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

![Python 打造高容錯搜尋引擎:BM25、Bigram 與difflib自動糾錯實戰; from rank_bm25 import BM25Okapi ; bm25 = BM25Okapi(corpus_tokens) #corpus_tokens: list[list[str]] Python 打造高容錯搜尋引擎:BM25、Bigram 與difflib自動糾錯實戰; from rank_bm25 import BM25Okapi ; bm25 = BM25Okapi(corpus_tokens) #corpus_tokens: list[list[str]]](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2026/02/20260209150527_0_a24c17.png?quality=90&zoom=2&ssl=1&resize=350%2C233)



近期留言