Client Status stays Closed for some time after Connect()

Smpp v3.4 client

Moderator: alt

Locked
koltaviy
Posts: 8
Joined: Mon Nov 17, 2008 9:59 am

Client Status stays Closed for some time after Connect()

Post by koltaviy » 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.

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.
alt
Site Admin
Posts: 988
Joined: Tue Apr 25, 2006 9:45 am

Post by alt » Tue Nov 18, 2008 6:08 pm

Hi, koltaviy.

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

Alexey
koltaviy
Posts: 8
Joined: Mon Nov 17, 2008 9:59 am

Post by koltaviy » Wed Nov 19, 2008 6:30 am

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.
Locked