469,954 Members | 1,777 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,954 developers. It's quick & easy.

I have a consoleApplication poject and I need a Form to run with the project also

2
I'm working on a client/server application.The client is a window Form and the server is a Console Application.
But now I also need a form in the server application,which I added. but if I call the form from
the main function it only shows a white form. If I call it from the receive function af the server the same happens.
Where do I have to call it from so it can work properly?

From the main function

static void Main(string[] args)
{

Form1 f1= new Form1 ();
f1.Show ();
try
{



Server s=new Server(9811);
s.receive();






}
catch(Exception e)
{
System.Console.WriteLine("Exceptie1..."+e);
}




}


From receive function

public void receive()
{


try
{

ss=new TcpListener(port);
}
catch
{
Console.WriteLine("Err la ServerSocket !");
}
ss.Start();



Form1 f1= new Form1 ();
f1.Show ();



while (true)
{
client=ss.AcceptTcpClient();
ns=client.GetStream();
sin = new StreamReader (ns);
sout = new StreamWriter(ns);
sout.AutoFlush=true;
MyThread th = new MyThread(sin,sout,listaS);
ThreadStart tStart=new ThreadStart(th.run);
Thread t=new Thread(tStart);
t.Start();



}

// sout.Close();
sin.Close();
}


}
Jun 10 '06 #1
0 1372

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by dit | last post: by
10 posts views Thread by Dave Taylor | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.