Refresh the connectivity

Post Reply
owlboo98
Posts: 15
Joined: Tue Apr 20, 2021 8:11 am

Refresh the connectivity

Post by owlboo98 » Tue Dec 21, 2021 9:46 am

Hi,
I have observed the problem of the refresh the SMPP connection from us and our provider SMSC.

Once our provider SMSC migrates their SMPP server to another host, they ask us to migrate the same.

I do some steps Unbind -> Disconnect from the current SMSC and call the _client.Dispose() method.

Once I tried to make the new instance of the SMPP client connect to the new SMSC, I was unable to connect, the connect process did not return the value.
owlboo98
Posts: 15
Joined: Tue Apr 20, 2021 8:11 am

Re: Refresh the connectivity

Post by owlboo98 » Fri Dec 24, 2021 7:12 am

Updated:
After I made several tests, I got this problem as the following logs.
Once the bindings were all up, I performed the disconnectAsync action, then reconnect by creating the new connection instances but it's throw this error.
At the SMPP server end, the event client connect was fired and the event client bind did not fire and the error came after a time.
Please help.

Code: Select all

2021-12-24 13:45:12,941 [1] DEBUG Provider Test 3--Transceiver--1.Socket - Establish connection to InterNetwork/127.0.0.1:8887
2021-12-24 13:45:12,966 [1] INFO Provider Test 3--Transceiver--1.Socket - 192.168.1.5:50248 => InterNetwork/127.0.0.1:8887 Connection established.
2021-12-24 13:45:16,411 [[Inetlab.SMPP] [Provider Test 3--Transceiver--1] [192.168.1.5:50248 => InterNetwork/127.0.0.1:8887] Send PDU to network stream] DEBUG Provider Test 3--Transceiver--1 - Send PDU: BindTransceiver, Sequence: 1
2021-12-24 13:45:16,423 [[Inetlab.SMPP] [Provider Test 3--Transceiver--1] [192.168.1.5:50248 => InterNetwork/127.0.0.1:8887] Send PDU to network stream] VERBOSE Provider Test 3--Transceiver--1.Socket - Sending data: Length=37, 
2021-12-24 13:45:16,442 [[Inetlab.SMPP] [192.168.1.5:50248 => InterNetwork/127.0.0.1:8887] Read data from network stream.] VERBOSE Provider Test 3--Transceiver--1.Socket - Received data: Length=29, 0000001d800000090000000000000001496e65746c61622e534d505000
2021-12-24 13:45:16,462 [7] DEBUG Provider Test 3--Transceiver--1 - PDU Received: BindTransceiverResp, Status: ESME_ROK, Sequence: 1, SystemId: 
2021-12-24 13:45:18,810 [1] DEBUG Provider Test 3--Transceiver--2.Socket - Establish connection to InterNetwork/127.0.0.1:8887
2021-12-24 13:45:18,823 [14] INFO Provider Test 3--Transceiver--2.Socket - 192.168.1.5:50265 => InterNetwork/127.0.0.1:8887 Connection established.
2021-12-24 13:45:20,409 [[Inetlab.SMPP] [Provider Test 3--Transceiver--2] [192.168.1.5:50265 => InterNetwork/127.0.0.1:8887] Send PDU to network stream] DEBUG Provider Test 3--Transceiver--2 - Send PDU: BindTransceiver, Sequence: 1
2021-12-24 13:45:20,410 [[Inetlab.SMPP] [Provider Test 3--Transceiver--2] [192.168.1.5:50265 => InterNetwork/127.0.0.1:8887] Send PDU to network stream] VERBOSE Provider Test 3--Transceiver--2.Socket - Sending data: Length=37, 
2021-12-24 13:45:20,421 [[Inetlab.SMPP] [192.168.1.5:50265 => InterNetwork/127.0.0.1:8887] Read data from network stream.] VERBOSE Provider Test 3--Transceiver--2.Socket - Received data: Length=29, 0000001d800000090000000000000001496e65746c61622e534d505000
2021-12-24 13:45:20,422 [8] DEBUG Provider Test 3--Transceiver--2 - PDU Received: BindTransceiverResp, Status: ESME_ROK, Sequence: 1, SystemId:
2021-12-24 13:45:32,973 [[Inetlab.SMPP] [Provider Test 3--Transceiver--1] [192.168.1.5:50248 => InterNetwork/127.0.0.1:8887] Send PDU to network stream] DEBUG Provider Test 3--Transceiver--1 - Send PDU: Unbind, Sequence: 2
2021-12-24 13:45:32,973 [[Inetlab.SMPP] [Provider Test 3--Transceiver--1] [192.168.1.5:50248 => InterNetwork/127.0.0.1:8887] Send PDU to network stream] VERBOSE Provider Test 3--Transceiver--1.Socket - Sending data: Length=16, 00000010000000060000000000000002
2021-12-24 13:45:32,982 [[Inetlab.SMPP] [192.168.1.5:50248 => InterNetwork/127.0.0.1:8887] Read data from network stream.] VERBOSE Provider Test 3--Transceiver--1.Socket - Received data: Length=16, 00000010800000060000000000000002
2021-12-24 13:45:32,983 [6] DEBUG Provider Test 3--Transceiver--1 - PDU Received: UnbindResp, Status: ESME_ROK, Sequence: 2
2021-12-24 13:45:32,987 [9] DEBUG Provider Test 3--Transceiver--1.Socket - 192.168.1.5:50248 => InterNetwork/127.0.0.1:8887 Start disconnecting.
2021-12-24 13:45:32,989 [9] DEBUG Provider Test 3--Transceiver--1.Socket - 192.168.1.5:50248 => InterNetwork/127.0.0.1:8887 Shutdown Send.
2021-12-24 13:45:32,992 [9] DEBUG Provider Test 3--Transceiver--1.Socket - 192.168.1.5:50248 => InterNetwork/127.0.0.1:8887 Connection closed.
2021-12-24 13:45:32,994 [[Inetlab.SMPP] [192.168.1.5:50248 => InterNetwork/127.0.0.1:8887] Read data from network stream.] DEBUG Provider Test 3--Transceiver--1.Socket - Receive data. A blocking socket was canceled. Code: 10004.
2021-12-24 13:45:33,340 [[Inetlab.SMPP] [Provider Test 3--Transceiver--2] [192.168.1.5:50265 => InterNetwork/127.0.0.1:8887] Send PDU to network stream] DEBUG Provider Test 3--Transceiver--2 - Send PDU: Unbind, Sequence: 2
2021-12-24 13:45:33,341 [[Inetlab.SMPP] [Provider Test 3--Transceiver--2] [192.168.1.5:50265 => InterNetwork/127.0.0.1:8887] Send PDU to network stream] VERBOSE Provider Test 3--Transceiver--2.Socket - Sending data: Length=16, 00000010000000060000000000000002
2021-12-24 13:45:33,350 [[Inetlab.SMPP] [192.168.1.5:50265 => InterNetwork/127.0.0.1:8887] Read data from network stream.] VERBOSE Provider Test 3--Transceiver--2.Socket - Received data: Length=16, 00000010800000060000000000000002
2021-12-24 13:45:33,350 [9] DEBUG Provider Test 3--Transceiver--2 - PDU Received: UnbindResp, Status: ESME_ROK, Sequence: 2
2021-12-24 13:45:33,351 [9] DEBUG Provider Test 3--Transceiver--2.Socket - 192.168.1.5:50265 => InterNetwork/127.0.0.1:8887 Start disconnecting.
2021-12-24 13:45:33,351 [9] DEBUG Provider Test 3--Transceiver--2.Socket - 192.168.1.5:50265 => InterNetwork/127.0.0.1:8887 Shutdown Send.
2021-12-24 13:45:33,351 [9] DEBUG Provider Test 3--Transceiver--2.Socket - 192.168.1.5:50265 => InterNetwork/127.0.0.1:8887 Connection closed.
2021-12-24 13:45:33,352 [[Inetlab.SMPP] [192.168.1.5:50265 => InterNetwork/127.0.0.1:8887] Read data from network stream.] DEBUG Provider Test 3--Transceiver--2.Socket - Receive data. A blocking socket was canceled. Code: 10004.
2021-12-24 13:46:54,094 [6] DEBUG Provider Test 3--Transceiver--1.Socket - Establish connection to InterNetwork/127.0.0.1:8887
2021-12-24 13:47:00,078 [6] DEBUG Provider Test 3--Transceiver--2.Socket - Establish connection to InterNetwork/127.0.0.1:8887
2021-12-24 13:47:05,162 [29] INFO Provider Test 3--Transceiver--1.Socket - 192.168.1.5:50551 => InterNetwork/127.0.0.1:8887 Connection established.
2021-12-24 13:47:05,162 [6] INFO Provider Test 3--Transceiver--2.Socket - 192.168.1.5:50587 => InterNetwork/127.0.0.1:8887 Connection established.
2021-12-24 13:48:54,121 [[Inetlab.SMPP] [192.168.1.5:50551 => InterNetwork/127.0.0.1:8887] Read data from network stream.] DEBUG Provider Test 3--Transceiver--1.Socket - 192.168.1.5:50551 => InterNetwork/127.0.0.1:8887 Remote side has dropped connection.
2021-12-24 13:48:54,122 [[Inetlab.SMPP] [192.168.1.5:50551 => InterNetwork/127.0.0.1:8887] Read data from network stream.] DEBUG Provider Test 3--Transceiver--1.Socket - 192.168.1.5:50551 => InterNetwork/127.0.0.1:8887 Start disconnecting.
2021-12-24 13:48:54,122 [[Inetlab.SMPP] [192.168.1.5:50551 => InterNetwork/127.0.0.1:8887] Read data from network stream.] DEBUG Provider Test 3--Transceiver--1.Socket - 192.168.1.5:50551 => InterNetwork/127.0.0.1:8887 Shutdown Send.
2021-12-24 13:48:54,122 [[Inetlab.SMPP] [192.168.1.5:50551 => InterNetwork/127.0.0.1:8887] Read data from network stream.] DEBUG Provider Test 3--Transceiver--1.Socket - 192.168.1.5:50551 => InterNetwork/127.0.0.1:8887 Connection closed.
2021-12-24 13:49:00,090 [[Inetlab.SMPP] [192.168.1.5:50587 => InterNetwork/127.0.0.1:8887] Read data from network stream.] DEBUG Provider Test 3--Transceiver--2.Socket - 192.168.1.5:50587 => InterNetwork/127.0.0.1:8887 Remote side has dropped connection.
2021-12-24 13:49:00,090 [[Inetlab.SMPP] [192.168.1.5:50587 => InterNetwork/127.0.0.1:8887] Read data from network stream.] DEBUG Provider Test 3--Transceiver--2.Socket - 192.168.1.5:50587 => InterNetwork/127.0.0.1:8887 Start disconnecting.
2021-12-24 13:49:00,090 [[Inetlab.SMPP] [192.168.1.5:50587 => InterNetwork/127.0.0.1:8887] Read data from network stream.] DEBUG Provider Test 3--Transceiver--2.Socket - 192.168.1.5:50587 => InterNetwork/127.0.0.1:8887 Shutdown Send.
2021-12-24 13:49:00,091 [[Inetlab.SMPP] [192.168.1.5:50587 => InterNetwork/127.0.0.1:8887] Read data from network stream.] DEBUG Provider Test 3--Transceiver--2.Socket - 192.168.1.5:50587 => InterNetwork/127.0.0.1:8887 Connection closed.
My code:

Code: Select all

for (; ; )
            {
                try
                {
                    if (_client.Status == ConnectionStatus.Bound)
                        break;
                    if (_client.Status != ConnectionStatus.Closed)
                        break;
                    if (Disposed)
                        break;
                    
                    if (await Connect())
                    {
                        if (await Bind())
                        {
                            break;
                        }
                        else
                        {
                            await _client.DisconnectAsync();
                        }
                    }
                    Thread.Sleep(5000);
                }
                catch (Exception)
                {
                    if (_client == null)
                    {
                        //WriteLog("ESMEConnection : PerformConnectClient : Info : Killing Thread");
                        return;
                    }
                    Thread.Sleep(5000);
                    // Drop the connection
                    await _client.DisconnectAsync();
                }

            }
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Refresh the connectivity

Post by alt » Mon Dec 27, 2021 4:57 pm

Which error do you mean? "Remote side has dropped connection." ? This error means that the provider didn't accept the TCP/IP connection from your IP. It can be a firewall issue.

Why do you use local IP address 127.0.0.1:8887 to connect to SMPP provider?

Consider connection recovery build-in feature in the library instead of manual reconnect.
owlboo98
Posts: 15
Joined: Tue Apr 20, 2021 8:11 am

Re: Refresh the connectivity

Post by owlboo98 » Tue Dec 28, 2021 1:14 am

Hi,
I used the local IP to check whether the client is connected or not.
The situation is our SMSC provider made a migration to a new IP/Port.
It will be no issue if I restart my application pool in IIS but the manual reconnect to the new host was failed.
After I made a reconnect action. The function client.ConnectAsync() running without responding.
In my SMPP server, I saw the client connected but it did not send any binding request.
The code is for initializing the connection once the application starts.
I want to disconnect the current session on the old IP and reconnect to the new IP.

I am using web API application and deployed in IIS.
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Refresh the connectivity

Post by alt » Tue Dec 28, 2021 4:30 pm

What library version are you using?
owlboo98
Posts: 15
Joined: Tue Apr 20, 2021 8:11 am

Re: Refresh the connectivity

Post by owlboo98 » Wed Dec 29, 2021 12:53 am

I am using version 2.8.0.
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Refresh the connectivity

Post by alt » Wed Dec 29, 2021 4:44 pm

Could you please test this case with the recent version of the library. Some issues with connect/disconnect are already fixed. See ChangeLog
owlboo98
Posts: 15
Joined: Tue Apr 20, 2021 8:11 am

Re: Refresh the connectivity

Post by owlboo98 » Thu Dec 30, 2021 12:33 am

I have retested the current version of lib and it works for me now.
Thank you for your support.
Post Reply