Click here to Skip to main content
15,503,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i wanna send one file through ip address i got error like this
No connection could be made because the target machine actively refused it 192.168.1.20:80

Below coding i written in this program....this is program error or it's related to firewall proble....but in my system i disable the firewall...

pls help me....


private void btnProcess1_Click(object sender, EventArgs e)
        {
            //----------------> Request to Central Server <----------------
           // TcpClient tc1 = new TcpClient();
            TcpClient tc1 = new TcpClient(txtGroupA.Text, 80);
            NetworkStream ns1 = tc1.GetStream();
            BinaryFormatter bf1 = new BinaryFormatter();
            bf1.Serialize(ns1, "Send Particulars of MultigroupA");
            TcpListener listen;

            Socket sk;
            listen = new TcpListener(8000);
            listen.Start();
            sk = listen.AcceptSocket();
            NetworkStream ns = new NetworkStream(sk);
            BinaryFormatter bf = new BinaryFormatter();
            object op;

            op = bf.Deserialize(ns);
            string returndata1 = op.ToString();

            char[] spiltch1 = { ' ' };
            string[] spit1 = null;
            spit1 = returndata1.Split(spiltch1);

            a11 = spit1[0].ToString();
            b1 = spit1[1].ToString();
            c1 = spit1[2].ToString();
            d1 = spit1[3].ToString();
            e1 = spit1[4].ToString();
            f1 = spit1[5].ToString();
            g1 = spit1[6].ToString();
            h1 = spit1[7].ToString();
            i1 = spit1[8].ToString();
            j1 = spit1[9].ToString();
            txtResTime1.Text = d1.ToString();
            txtPathA.Text = e1.ToString();
            txtResB.Text = i1.ToString();
            txtPathB.Text = j1.ToString();


            ns.Close();
            sk.Close();
}

"I got error in that highlighted line"
Posted
Comments
Richard MacCutchan 4-Dec-12 4:05am    
Do you have an application that is listening on port 80 at that IP address?
Deenuji 4-Dec-12 4:10am    
nope sir....this is my friend project.... he write port is 6060 but i changed to 80.... but again i'm getting the same error only....
Mendor81 4-Dec-12 11:14am    
Probably because the 80 is a default port try use another port.

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