broken connection

Smpp v3.4 client

Moderator: alt

Locked
zmrcic
Posts: 4
Joined: Sat Mar 15, 2008 4:07 pm

broken connection

Post by zmrcic » Fri Apr 04, 2008 6:10 am

I think product is something special...I'm using it for few months and its great...
but my problem is internet connection...from time to time my pc gets disconnected from internet due to providers low capacity...
Is there an event I can raise when something like that happens...
I send EnquireLink but I get no response...
How to solve this...
alt
Site Admin
Posts: 988
Joined: Tue Apr 25, 2006 9:45 am

Post by alt » Sat Apr 05, 2008 4:35 am

When you get no response of EnquireLink, you need to reestablish connection and bind with SMSC. In my application I stop all threads, reconnect SmppClient and run all threads again. Sometimes you need to wait several seconds before reestablishing connection because SMSC return ESME_RBINDFAIL.
zmrcic
Posts: 4
Joined: Sat Mar 15, 2008 4:07 pm

Post by zmrcic » Sat Apr 05, 2008 10:49 am

Yes, but how to find out if there is no EnquireLink response....
I just have "sending data....." and app hangs...

offcourse I have thread that check if client is connected, and if its not I'm connecting again, but how to catch that very moment when I'm getting disconnected?

thanks
alt
Site Admin
Posts: 988
Joined: Tue Apr 25, 2006 9:45 am

Post by alt » Sun Apr 06, 2008 7:57 am

try this code
EnquireLinkResp res = client.EnquireLink();
if (res.Status != CommandStatus.ESME_ROK)
{
// reconnect with SMSC
}
zmrcic
Posts: 4
Joined: Sat Mar 15, 2008 4:07 pm

Post by zmrcic » Mon Apr 07, 2008 6:03 am

Thanks....I'm doing something else...I have new thread that starts when client gets connected..
Sub RequeryStatus()
If Not (client Is Nothing) Then
If Me.client.IsConnected = False Then
Me._Connect()
If Me.client.Status = ConnectionStatus.Open Then
Me._Bind()
End If
End If
End If
backThread.Sleep(10000)
RequeryStatus()

I have problem since different providers are using different protocols...smpp and http...
Locked