Hello,
I have a problem with a TCP Asyncronous Server Implementation.
I take the solution from the Microsoft Site
(http://msdn.microsoft.com/library/de...-us/cpguide/ht
ml/cpconnon-blockingserversocketexample.asp) and implemented it but when i
test it I get problems...
I used the below test client code to test the Syncronous Server but after a
while (sometime 5 minutes, sometimes 10 minutes, sometimes 1 hour and
sometimes more) the server stop to respond Client Connect requests.
I debug the server code and I find that the Server get locked in the While
loop of the StarListening Sub (you can see the Server code in the link
above).
class Client
{
[STAThread]
static void Main()
{
do
{
string ipConnect = "127.0.0.1";
int portConnect = 11000;
TcpClient tcpclnt = new TcpClient();
try
{
tcpclnt.Connect(ipConnect,portConnect);
Stream stm = tcpclnt.GetStream();
ASCIIEncoding asen= new ASCIIEncoding();
byte[] StrOut =
asen.GetBytes("0157SITE01220000001681E611E1C633907 06141214
00005535<PedTables><TABLE><R
MESS=\"1\"NAME=\"STATE\"></R></TABLE></PedTables><EOF>");
stm.Write(StrOut,0,StrOut.Length);
stm.Close();
tcpclnt.Close();
Thread.Sleep(100);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
} while (true);
}
}
Any idea to help me? What can I do to unlock the Server?
Thanks in advance and sorry for my poor English. I'm from Argentina.
Andrés
Mail: an***********@arnet.com.ar
MSN: an***********@hotmail.com (I will waiting here...)