• send and recieve message with myself (python socket )


    # socket server
    import socket
    sk = socket.socket()
    sk.bind(("127.0.0.1",8082))
    sk.listen()
    conn, addr = sk.accept()
    message = conn.recv(1024)
    print(message)
    conn.send(b"hello, world")
    conn.close()
    sk.close()
    
    #socket client
    import socket
    sk = socket.socket()
    sk.connect(("127.0.0.1",8082))
    sk.send(b"hello you ")
    message = sk.recv(1024)
    print(message)
    sk.close()

    sorry about having no annotation for every code

    if we run the programme in one IDLE, we will have error such as ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

    so i seek help on internet , the solution of the problem is to open two IDLE , and the problem will be solved.

  • 相关阅读:
    hadoop2.3.0cdh5.0.2 升级到cdh5.7.0
    strace
    ganglia3.7.2,web3.7.1安装
    hadoop balancer
    linux-小命令
    Ceph 架构以及原理分析
    Ceph 文件存储
    Ceph 对象存储
    Ceph 块存储
    Ceph 集群搭建
  • 原文地址:https://www.cnblogs.com/zijidefengge/p/11601096.html
Copyright © 2020-2023  润新知