check user information when binding

.NET library for SMPP protocol
Locked
mobilyws
Posts: 14
Joined: Sat Jan 14, 2012 1:25 pm

check user information when binding

Post by mobilyws » Sun Nov 25, 2012 9:43 am

Dear ALT,

hope you are doing well,,

currently i want to develop an smpp server that accepts connections from customer,
i want to know how i can return to the customer that your user name is wrong or your password is long

and just check the information server_evbind or there is another event

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

Re: check user information when binding

Post by alt » Tue Nov 27, 2012 10:53 am

Following code shows how you can return non-OK status to client.

Code: Select all

_server.evClientBind += server_evClientBind;

private void server_evClientBind(object sender, Inetlab.SMPP.Common.SmppServerClient client, Inetlab.SMPP.PDU.Bind data)
{

   data.Response.ChangeSystemId("My SMPP Server");

  //Check SMPP access, and if it is wrong retund Bind Failed.
   if (data.SystemId == "")
   {
         data.Response.Status = CommandStatus.ESME_RINVSYSID; 
         return;
   }
   if (data.Password == "")
   {
        data.Response.Status = CommandStatus.ESME_RINVPASWD; 
        return;
   }
}
Also you can use another statuses such as ESME_RALYBND, ESME_RBINDFAIL
Locked