Re: No connection could be made because the target machine actively refused it. - 'System.Net.Socket

G

Grant Richard

The security would be on the server side for refusing it.

Using: [SocketPermission(SecurityAction.Demand, Unrestricted=true)] on the
method that opens the server socket would allow the TCPClient to contact it.
 
H

Hazzard

Thank you Grant. I am getting build errors when I insert your code so I am
reading about code access security. Thank you for pointing me in that
direction.
I will report back when I achieve success.
-greg

Grant Richard said:
The security would be on the server side for refusing it.

Using: [SocketPermission(SecurityAction.Demand, Unrestricted=true)] on the
method that opens the server socket would allow the TCPClient to contact it.



Hazzard said:
The following code;

TcpClient client = new TcpClient();
client.Connect("localhost", 9999);
Stream stream = client.GetStream();

causes the following exception as the attached .jpg shows;

"No connection could be made because the target machine actively refused it"

is this a code access security issue? how is it resolved?
thank you,
-greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top