Example #1
0
        public void initListenerService(String sIP, int nPort, int nBacklog)
        {
            if (sIP == null)
            {
                throw new ArgumentNullException("IP value is null");
            }
            if (nPort <= 0 || nBacklog <= 0)
            {
                throw new ArgumentException("Port or Backlog value is null");
            }

            if (eventAllEventLogger != null)
            {
                eventAllEventLogger(null, "Initialize listener Service");
            }

            if (eventAllEventLogger != null)
            {
                eventAllEventLogger(null,
                                    "Try to create Listener IP " + sIP + ", Port " + nPort.ToString() + ", Backlog " + nBacklog.ToString());
            }

            try
            {
                m_cListener = new CListener(sIP, nPort, nBacklog);
                m_cListener.eventAcceptNewClient += _handleApccept;
            }
            catch (Exception e)
            {
                if (eventAllEventLogger != null)
                {
                    eventAllEventLogger(null, e.ToString());
                }
            }
        }
Example #2
0
 public static CListener GetInstance()
 {
     if (null == mInstance)
     {
         mInstance = new CListener();
     }
     return(mInstance);
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     mField   = GetComponentInChildren <InputField>();
     Sender   = new CSender();
     listener = CListener.GetInstance();
 }