import socket
import sys
import datetime
import os
try:
username = "root"
password = "Apacheah64"
db_name = "DB_GPS"
table_name = "Tbl_GPS"
host = ""
port = 6903
buf = 4096
except IndexError:
sys.exit(1)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind((host, port))
while 1:
data = s.recv(buf)
if not data:
print("Client has exited!")
break
else:
print("\nReceived message '", data,"'")
# Close socket
s.close()
我收到的字节应该是 43 字节,但我从客户端收到的是
收到消息'b'\x0f\x00\x00\x00NR09G05164\x00''?只有 15 个字节。为什么?
下面是原始字节 43 字节
00 00 00 01 00 06 ec 44 76 a6 21 c2 00 00 08 00
45 00 00 2b 08 43 00 00 34 11 81 2b cb 52 50 db
67 0d 7a 19 24 2d 1a f7 00 17 83 26 0f 00 00 00
4e 52 30 39 47 30 35 31 36 34 00