[英]Java: DataOutputStream through socket is wrong on other side (which is Python)
我有一個Socket
, s
和long
, 1312992
。
DataOutputStream out = new DataOutputStream(s.getOutputStream());
out.writeLong(hwnd);
out.flush();
在做
self.hwnd, = struct.unpack('!Q', self.appletconn.recv(8))
print(self.hwnd)
在(python)接收端打印51
。 我認為我的發送代碼有問題。
謝謝。
使用數據包捕獲工具(如tcpdump或Wireshark),檢查線路上的狀況。 我猜,您可能在發送和/或接收端混合了文本和二進制文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.