Radim Chat Client napravio sam al erore izbacuje ako moze pomoc.linija gde je eror stavit cu ispred skripte liniju.
ERRORI
[pawn]
Severity Code Description Project File Line Suppression State
Error CS1061 'StreamReader' does not contain a definition for 'AutoFlush' and no extension method 'AutoFlush' accepting a first argument of type 'StreamReader' could be found (are you missing a using directive or an assembly reference?) Chat Client 0.1b C:\Users\Sanel\Desktop\Chat Client 0.1b\Chat Client 0.1b\Form1.cs 47 Active
Severity Code Description Project File Line Suppression State
Error CS1061 'StreamReader' does not contain a definition for 'WriteLine' and no extension method 'WriteLine' accepting a first argument of type 'StreamReader' could be found (are you missing a using directive or an assembly reference?) Chat Client 0.1b C:\Users\Sanel\Desktop\Chat Client 0.1b\Chat Client 0.1b\Form1.cs 76 Active
Severity Code Description Project File Line Suppression State
Error CS0103 The name 'client_Connected' does not exist in the current context Chat Client 0.1b C:\Users\Sanel\Desktop\Chat Client 0.1b\Chat Client 0.1b\Form1.cs 94 Active
Severity Code Description Project File Line Suppression State
Error CS0029 Cannot implicitly convert type 'System.IO.StreamWriter' to 'System.IO.StreamReader' Chat Client 0.1b C:\Users\Sanel\Desktop\Chat Client 0.1b\Chat Client 0.1b\Form1.cs 97 Active
Severity Code Description Project File Line Suppression State
Error CS1061 'StreamReader' does not contain a definition for 'AutoFlush' and no extension method 'AutoFlush' accepting a first argument of type 'StreamReader' could be found (are you missing a using directive or an assembly reference?) Chat Client 0.1b C:\Users\Sanel\Desktop\Chat Client 0.1b\Chat Client 0.1b\Form1.cs 99 Active
[/pawn]
ev skripta :D
[pawn]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.IO;
namespace Chat_Client_0._1b
{
public partial class Form1 : Form
{
private TcpClient client;
public StreamReader STR;
public StreamReader STW;
public string receive;
public String text_to_send;
public Form1()
{
InitializeComponent();
IPAddress[] localIP = Dns.GetHostAddresses(Dns.GetHostName());
foreach (IPAddress address in localIP)
{
if(address.AddressFamily == AddressFamily.InterNetwork)
{
textBox3.Text = address.ToString();
}
}
}
private void button2_Click(object sender, EventArgs e) ////START SERVER
{
TcpListener listener = new TcpListener(IPAddress.Any, int.Parse(textBox4.Text));
listener.Start();
client = listener.AcceptTcpClient();
STR = new StreamReader(client.GetStream());
46: STW = new StreamWriter(client.GetStream());
47: STW.AutoFlush = true;
backgroundWorker1.RunWorkerAsync(); // start receiving data in background
backgroundWorker2.WorkerSupportsCancellation = true; // Abillity to cancel this thread
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) ///reseive data
{
while(client.Connected)
{
try
{
receive = STR.ReadLine();
this.textBox2.Invoke(new MethodInvoker(delegate () { textBox2.AppendText("On : " + receive + "\n"); }));
receive = "";
}
catch (Exception x)
{
MessageBox.Show(x.Message.ToString());
}
}
}
private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e) ////send data
{
if (client.Connected)
{
76: STW.WriteLine(text_to_send);
this.textBox2.Invoke(new MethodInvoker(delegate () { textBox2.AppendText("Me : " + text_to_send + "\n"); }));
}
else
{
MessageBox.Show("Send failed");
}
backgroundWorker2.CancelAsync();
}
private void button3_Click(object sender, EventArgs e)
{
client = new TcpClient();
IPEndPoint IP_End = new IPEndPoint(IPAddress.Parse(textBox5.Text), int.Parse(textBox6.Text));
try
{
client.Connect(IP_End);
94: if (client_Connected)
{
textBox2.AppendText("Connected to Server" + "\n");
97: STW = new StreamWriter(client.GetStream());
STR = new StreamReader(client.GetStream());
99: STW.AutoFlush = true;
backgroundWorker1.RunWorkerAsync(); // Start receiving Data in background
backgroundWorker2.WorkerSupportsCancellation = true; // Abillity to cancel this thread
}
}catch (Exception x)
{
MessageBox.Show(x.Message.ToString());
}
}
private void button1_Click(object sender, EventArgs e)
{
if(textBox1.Text != "")
{
text_to_send = textBox1.Text;
backgroundWorker2.RunWorkerAsync();
}
textBox1.Text = "";
}
}
}
[/pawn]
moze neko pomoc?