20190414
Paketage Spiling
sk.send(b'123)
sk.seng(b'456)
possible:>>>b'123456
ture is >>>b'123
>>>b'456
Coding
PY3:(Str,Bytes)
str:unicode >>>>(encoding)['utf8']>>>>>>>>byte
byte:hexdecimal>>>>>(decoding)['utf8']>>>>>>>>str
s = 'hello,world' # class of str is encoded with unicode b1 = s.encode('utf8') # encode the str obj with utf8 and b1 is a byte value with encoding by utf8 print(b1) b2 = bytes(s,'utf8') # convert the str obj(s) to byte obj(b2) by utf8 encoding form print(b2) s1 = b1.decode('utf8') print(s1) s2 = str(b2,'utf8') print(s2)
########三次握手##########
IP >>>>>>>>Port>>>>>>>>>>Tcp/Udp
family=AF_INET/AF_UNIX
type=SOCK_STREAM/SOCK_DGRAM
server>><<<<<>(soket)>><<<<<>>client
Rece------Send
while len(Rmessage) != DateLenth:
Rmessagee = sk.recv(1024)
Rmessage+= Rmessagee
本文来自博客园,作者:pie_thn,转载请注明原文链接:https://www.cnblogs.com/pie-o/p/10704083.html

浙公网安备 33010602011771号