Am trying to create a server application in c#.In the code am using the TcpListener class.
TcpListener t = new TcpListener(5555);
t.Start();
However it is providing an error saying: Invalid token '(' in class, struct, or interface member declaration.
Are there additional references required?.
Please help.
namespace WindowsApplication1
{
public partial class lanmessenger : Form
{
[DllImport("user32.dll")]
static extern bool HideCaret(IntPtr hWnd);
public lanmessenger()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder(this.textBox1.Text);
sb.AppendLine(this.textBox2.Text);
this.textBox1.Text = sb.ToString();
this.textBox2.Text = "\0";
HideCaret(this.textBox1.Handle);
}
private void textBox1_MouseClick(object sender, MouseEventArgs e)
{
HideCaret(this.textBox1.Handle);
}
StreamWriter streamWriter;
StreamReader streamReader;
NetworkStream networkStream;
TcpListener t = new TcpListener(5555);
t.Start();
}
}
This is the full source code upto now. Am unable to find the error.