如何为我的TCP c服务器创建python(或swift)TCP客户端?你知道吗
我的TCP服务器的c#API:
Client client = Client();
bool Connect()
{
UserInfo userInfo = new UserInfo("login", "pass");
NetworkConnectionParam connectionParams = new NetworkConnectionParam("127.0.0.1", 4021);
try
{
client.Connect(connectionParams,userInfo,ClientInitFlags.Empty);
}
catch
{
return false;
}
return client.IsStarted;
}
我试过了(python):
import socket
sock = socket.socket()
sock.connect(('localhost', 4021))
但我不明白我必须如何发送我的登录名和密码(就像c#的API一样)。你知道吗
我不明白你想实施什么。 如果您想在C#中运行Python代码,那么请看这个IronPython
如果要在C#中实现TCP客户机,请尝试以下方法:
相关问题 更多 >
编程相关推荐