Client Status stays Closed for some time after Connect()
Posted: Mon Nov 17, 2008 10:15 am
Hi, everybody.
The problem is that i haven't got the Open status after i call Connect method.
When i check the status i usually get the closed status instead of the Open one. I solved the problem using the while loop. When the rows are uncommented everything works fine: I get the "Connection failed" message first and after that, on the second loop, i get the open status and the binding occurs.
What are the reasons of such a behaviour?
I tried to use the evConnect event, but it wasn't useful:
Just the same "Connection fails" message - that's all what i get.
The problem is that i haven't got the Open status after i call Connect method.
Code: Select all
if (_smppClient.Status == ConnectionStatus.Closed)
_smppClient.Connect(_hostName, Convert.ToInt32(_port));
//while (true)
{
if (_smppClient.Status == ConnectionStatus.Open)
{
if (OnConnected != null)
OnConnected();
Bind();
//break;
}
else
if (OnError != null)
OnError("Connection failed");
}
What are the reasons of such a behaviour?
I tried to use the evConnect event, but it wasn't useful:
Code: Select all
private void smppClient_evConnect(object sender, bool success)
{
if (success)
{
if (_smppClient.Status == ConnectionStatus.Open)
{
if (OnConnected != null)
OnConnected();
Bind();
}
else
if (OnError != null)
OnError("Connection failed");
}
else
if (OnError != null)
OnError("Already connected");
}