繁体   English   中英

如何将图像发送到服务器计算机并下载? [复制]

[英]How do I send an image to the server computer and download it? [duplicate]

我想发送我在另一台计算机上拍摄的屏幕截图并将其发送给我的主机。 我想使用 sockets 来做到这一点。 我该怎么做? 我有这个:

if command == "screenshot":
    s.send("Command received.".encode())
    screensaveshot = pyautogui.screenshot()
    screensaveshot.save('screenshot.png')
    imgcounter = 1
    basename = "screenshot.png"
    data = s.recv(4096)
    txt = str(data)
    myfile = open(basename % imgcounter, 'wb')
    myfile.write(data)
    data = s.recv(40960000)
    myfile.close()

您可以将 tqdm 用于您的目的。 看看这个网站https://www.thepythoncode.com/article/send-receive-files-using-sockets-python如果你想将文件发送到其他计算机,你可以通过替换 ngrok 来使用 ngrok 作为服务器提供商套接字连接中的地址。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM