I am trying to make connection with remote system in the network using C#. then the program is throwing the following exception
No connection could be made because the target machine actively refused it 192.168.1.42:8000
private void Start_Sending_Video_Conference(string remote_IP,int port_number)
{
try
{
ms = new MemoryStream();// Store it in Binary Array as
pictureBox1.Image.Save(ms,System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] arrImage = ms.GetBuffer();
myclient = new TcpClient (remote_IP,port_number);//Connecting with server
myns = myclient.GetStream ();
mysw = new BinaryWriter (myns);
mysw.Write(arrImage);//send the stream to above address
ms.Flush();
mysw.Flush();
myns.Flush();
ms.Close();
mysw.Close ();
myns.Close ();
myclient.Close ();
}
catch (Exception ex)
{
Capturing.Enabled = false;
MessageBox.Show(ex.Message, "Video Conference Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
Are you sure something is listening on the other end? In this case, it appears that your local server is actually denying the request. Please confirm that the server is running, the TCPServer is listening, and that the machine the server is running from (if it’s locally, this shouldn’t be a problem) is setup to allow incoming packets from the LAN.