我试图使服务器和客户端成为没有套接字的类似程序,因为我无法使用互联网来传递数据。我尝试使用管道标准输入,但我无法做到这一点......我有什么选择?
服务器:
def main():
try:
res = ""
while res != "exit":
res = input()
print("\n", res, "\n")
except EOFError as e:
print(e)
if __name__ == "__main__":
main()
客户:
import subprocess
import os
import sys
def main():
p = subprocess.Popen(['python', 'b.py'], stdin=subprocess.PIPE)
res = ""
while res != "exit":
res = os.fsencode(input(">> "))
p.stdin.write(res)
if __name__ == "__main__":
main()
SMILET
拉莫斯之舞
相关分类