[英]Error: No connection could be made because the target machine actively refused it
i use this code for working with Port我使用此代码与 Port 一起工作
https://docs.microsoft.com/en-us/dotnet/framework/network-programming/asynchronous-client-socket-example https://docs.microsoft.com/en-us/dotnet/framework/network-programming/asynchronous-client-socket-example
but I get the following error.但我收到以下错误。 No connection could be made because the target machine actively refused it.
由于目标机器主动拒绝,无法建立连接。
Should I not connect(bind) the socket to the port?我不应该将套接字连接(绑定)到端口吗?
First we have to check whether the Database service or particular service is started or Dead position by using this command in linux terminal首先,我们必须在 linux 终端中使用此命令检查数据库服务或特定服务是否已启动或已死 position
If particular service status is Dead or inactive then we have to start the service by using如果特定服务状态为 Dead 或 inactive 那么我们必须使用
Then check the connection, it will connect Absolutely然后检查连接,它会连接 Absolutely
i changd code.我更改代码。
Socket listener = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp)
listener.Bind(localEndPoint);
listener.Listen(200);
worked.But I didn't understand why I had to do this?工作。但我不明白为什么我必须这样做?
There is no such thing in Microsoft's code.微软的代码中没有这样的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.