Page 1 of 1

broken connection

Posted: Fri Apr 04, 2008 6:10 am
by zmrcic
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...

Posted: Sat Apr 05, 2008 4:35 am
by alt
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.

Posted: Sat Apr 05, 2008 10:49 am
by zmrcic
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

Posted: Sun Apr 06, 2008 7:57 am
by alt
try this code
EnquireLinkResp res = client.EnquireLink();
if (res.Status != CommandStatus.ESME_ROK)
{
// reconnect with SMSC
}

Posted: Mon Apr 07, 2008 6:03 am
by zmrcic
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...