• python_day8 socket 网络编程 基本篇


    服务端:

    server=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    server.bind(('127.0.0.1',80))
    server.listen(5)
    conn,address=server.accept()
    data=conn.recv(1024)
    print(data)
    conn.send(data.upper())
    conn.close()
    server.close()



    客户端
    import socket
    client=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    client.connect(('127.0.0.1',80))
    client.send('aaa'.encode('utf-8'))
    data=client.recv(1024)
    print(data)
    client.close()
  • 相关阅读:
    线程和进程
    Map和Collection
    数组
    泛型
    堆和栈
    Java的三大特性
    Log日志
    关系运算
    switch
    main 及Scanner
  • 原文地址:https://www.cnblogs.com/onda/p/7054550.html
Copyright © 2020-2023  润新知