Page 1 of 1

Client Status stays Closed for some time after Connect()

Posted: Mon Nov 17, 2008 10:15 am
by koltaviy
Hi, everybody.
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");                     
            } 
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:

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");
        }
Just the same "Connection fails" message - that's all what i get.

Posted: Tue Nov 18, 2008 6:08 pm
by alt
Hi, koltaviy.

Please try to download last version. I made some fixes in Connect method.
Now it should return correct status.

Alexey

Posted: Wed Nov 19, 2008 6:30 am
by koltaviy
alt wrote:Hi, koltaviy.

Please try to download last version. I made some fixes in Connect method.
Now it should return correct status.

Alexey
Looks like really fixed. Thanks.