blueprint

TCP _ SOcket With Python 3.9

  • Exposure: public
  • UE Version: 5.2

lastime1650

July 17, 2023, 8:15 am

Click the button above, it will automatically copy blueprint in your clipboard. Then in Unreal Engine blueprint editor, paste it with ctrl + v

1 comment

  • lastime1650

    July 17, 2023, 8:15 am

    import socket import time

    class AI_class(): def init(self, ip, port): self.server_ip = str(ip) self.server_port = int(port) self.sockets = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

    def start(self):
        self.sockets.bind((self.server_ip, self.server_port))
    
        self.sockets.listen(5)
    
        #is_init = True
        while True:
    
            self.client_socket, notthings = self.sockets.accept()
            print("클라이언트와 연결됨")
            time.sleep(1)
            self.client_socket.sendall("Hello".encode())
            #is_init = False
            self.client_socket.settimeout(1)
            print( str( self.client_socket.recv(1024).decode() ) )
            self.client_socket.close()

    AI_instance = AI_class("192.168.0.100", 12344) AI_instance.start()