Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I trying to connect sockets I got below error message

no connection could be made because the target machine actively refused it

see my code

C#
public void Connect1(string host, int port)
      {
          IPAddress[] IPs = Dns.GetHostAddresses(host);

          Socket s = new Socket(AddressFamily.InterNetworkV6,
              SocketType.Stream,
              ProtocolType.Tcp);

          txtPassWord.Text = "Establishing Connection to " + host;
          if(!s.Connected)
          s.Connect(IPs[1], port);
           txtPassWord.Text += "Connection established";
      }


I am passing my machine hostname and ip.

any suggestions appreciate...
Posted
Updated 17-Feb-14 20:50pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900