عندي مشكلة في اول برنامج اكتبه في برمجة الشبكات وهو البرنامج الاول في كتاب احترف برمجة الشبكات
الخطأ هو
No connection could be made because the target machine actively
refused it 127.0.0.1:5020
الكود هو
Code:
private void button1_Click(object sender, EventArgs e)
{
try
{
MemoryStream ms = new MemoryStream();
//Save the picture in memory stream
pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
//convert image to binary data
byte[] buffer = ms.GetBuffer();
ms.Close();
//connecting with the server
TcpClient tcpClient = new TcpClient(textBox1.Text, 11000);
NetworkStream ns = tcpClient.GetStream();
BinaryWriter bw = new BinaryWriter(ns);
//send the stream to the address
bw.Write(buffer);
}
catch (SocketException ex)
{ MessageBox.Show(ex.Message); }
catch (Exception ex)
{ MessageBox.Show(ex.Message); }
}