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

  

posted @ 2019-04-14 10:08  pie_thn  阅读(85)  评论(0编辑  收藏  举报