Login  
Search All Forums
Dart Home | PowerTCP Sockets for .NET | Custom Development Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
AuthorForum: PowerTCP Sockets for .NET (Secure and Standard)
Topic: sockets for .NET server control question for help!
lwpj

From: chongqing, Peoples Rep of China
Posts: 3
Member Since: 01/08/05
posted January 8, 2005 2:21 AM

I have written a simple application(as sever) using the server component. It has a loop in the Connection event handler,and in this loop there has a "foreach" code segment that calls tcp.Stream.Write.The calls same as follow:
private void server1_Connection(object sender, Dart.PowerTCP.Sockets.ConnectionEventArgs e)
{
 while(e.Tcp.Connected==true)
 {
 for(int i=0;i<512*10;i++)
 {
  foreach(Dart.PowerTCP.Sockets.Tcp tcp in              server1.Connections)
  {
   tcp.Stream.Write(buffer,0,buffer.Length);
  tcp.Stream.Flush();
  }
 }
}
. I have another simple app(as client) that uses the tcp component to connect and receive some data from it. if there is one client,that's allright. However, when I open two or more clients, the data that server send are not the right data that i send.what cause this wrong? I need your help,Thank you!
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted January 8, 2005 1:28 PM

Why are you sending out to every client when one client connects? Is that really what you want?

Have you looked at any of the sample apps? The Character generator would be the best place for you to start.


lwpj

From: chongqing, Peoples Rep of China
Posts: 3
Member Since: 01/08/05
posted January 9, 2005 9:08 PM

thank for your reply!
 Yes I want do that,because the data that I will send are real-time data(not character but number),and i need all clients can receive it in time.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted January 9, 2005 10:16 PM

Why are you calling Stream.Write and Stream.Flush? Why don't you just call Send? Is there a specific reason why you are doing it that way? If not try using Send instead and see what happens.
lwpj

From: chongqing, Peoples Rep of China
Posts: 3
Member Since: 01/08/05
posted January 10, 2005 2:50 AM

Thank for your advice!!
The question I have been solved!
Thanks again!
Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX