gpt4 book ai didi

c# - 使用套接字将波斯字符串从 C# 服务器发送到 python 客户端

转载 作者:太空宇宙 更新时间:2023-11-03 16:04:43 24 4
gpt4 key购买 nike

我使用套接字编程将 python 程序连接到 C# 程序。python代码是客户端,C#代码是服务器。 C# 代码使用以下代码将字符串发送到 python:

byte[] R=Encoding.UTF8.GetBytes("one string");
Client.Send(R);

我用Python代码接收数据:

data=sock.recv(16)
amount_received+=len(data)
print >> sys.stderr, 'received "%s" %data

当我打印收到的数据时: print >> sys.stderr, 'received "%s"%data ,我只看到一些问号。我必须做什么?

最佳答案

尝试

byte[] R = Encoding.Default.GetBytes("Persian String"); 

关于c# - 使用套接字将波斯字符串从 C# 服务器发送到 python 客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39955744/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com