//private SmppConnection mySmppClient = new SmppConnection(); /// <summary> /// ------------> /// </summary> /// <param name="transportprotocol"></param> public SmppMessenger(TransportProtocols transportprotocol, string DeliveryResponseMessageQueue, string shortCodePrefixToTrim) { m_DeliveryResponseMessageQueue = DeliveryResponseMessageQueue; ShortCodePrefixToTrim = shortCodePrefixToTrim; // 234 prefix to trim from shortcodes // log4net here string appId = String.Format(@"{0}\{1}.exe", Environment.CurrentDirectory, Assembly.GetExecutingAssembly().GetName().FullName); XmlConfigurator.Configure(new System.IO.FileInfo(Settings.Default.InstrumentationFileName)); log4net.LogicalThreadContext.Properties["identity"] = appId; //id:483D47F1 sub:001 dlvrd:001 submit date:0905151857 done date:0905151857 stat:DELIVRD err:000 Text:Dear Godwin Akpabio tProtocol = transportprotocol; // Treat the mode in which client will bind based on protocol version if (tProtocol.ProtocolVersion < 3.4) { // Transmitter smppconn = new SmppConnection(); InitializeParameters(smppconn, SmppConnectionMode.Transmitter, tProtocol); // Client disconnected smppconn.OnEnquireLinkReq += new SmppEnquireLinkHandler(smppconn_OnEnquireLinkReq); smppconn.OnUnBindReq += new SmppUnBindHandler(smppconn_OnUnBindReq); //No neet towait for message //smppconn.OnDeliverSmReq += new SmppDeliverSmHandler(smppconn_OnDeliverSmReq); // Receiver smppconn2 = new SmppConnection(); InitializeParameters(smppconn2, SmppConnectionMode.Receiver, tProtocol); // Client disconnected smppconn2.OnEnquireLinkReq += new SmppEnquireLinkHandler(smppconn_OnEnquireLinkReq); smppconn2.OnUnBindReq += new SmppUnBindHandler(smppconn_OnUnBindReq); smppconn2.OnDeliverSmReq += new SmppDeliverSmHandler(smppconn_OnDeliverSmReq); } else { // Tranceiver smppconn = new SmppConnection(); InitializeParameters(tProtocol); // Client disconnected smppconn.OnEnquireLinkReq += new SmppEnquireLinkHandler(smppconn_OnEnquireLinkReq); smppconn.OnUnBindReq += new SmppUnBindHandler(smppconn_OnUnBindReq); smppconn.OnDeliverSmReq += new SmppDeliverSmHandler(smppconn_OnDeliverSmReq); } enquireTimer = new System.Timers.Timer(double.Parse(tProtocol.EnquireLinkInterval.ToString())); enquireTimer.Elapsed += new ElapsedEventHandler(timerElapsedEvent); enquireTimer.Enabled = false; }
private void InitializeParameters(SmppConnection smppX, SmppConnectionMode smppConnectionMode, TransportProtocols tProtocol) { if (IsValidIP(tProtocol.RemoteHost) == true) { smppX.Settings.RemoteHost = tProtocol.RemoteHost; } else { try { IPAddress[] address = Dns.GetHostAddresses(tProtocol.RemoteHost); foreach (IPAddress theaddress in address) { smppX.Settings.RemoteHost = theaddress.ToString(); break; } } catch (Exception ex) { // ex.Message; } } smppX.Settings.Timeout = tProtocol.Timeout; smppX.Settings.ConnectionMode = smppConnectionMode; smppX.Settings.RemotePort = tProtocol.RemotePort; smppX.Settings.BindParams.AddressRange = tProtocol.AddressRange; //mySmppClient.Settings.BindParams.AddressNpi = Convert.ToByte(1); //mySmppClient.Settings.BindParams.AddressTon = Convert.ToByte(1); smppX.Settings.BindParams.Password = tProtocol.Password; smppX.Settings.BindParams.SystemId = tProtocol.SystemID; smppX.Settings.BindParams.SystemType = tProtocol.SystemType; smppX.Settings.BindParams.InterfaceVersion = Convert.ToByte(52); logger.Info(tProtocol.NetworkID + ":" + tProtocol.OperatorID + ": Initialized Successfully\n"); }