public DisServiceProxyCallbackHandler(DisServiceProxy proxy, CommHelper callbackCommHelper)
        {
            if (proxy == null) {
                throw new ArgumentNullException ("proxy");
            }

            if (callbackCommHelper == null) {
                throw new ArgumentNullException("callbackCommHelper");
            }

            _proxy = proxy;
            _commHelper = callbackCommHelper;
			_asciiEnc = new System.Text.ASCIIEncoding();
        }
示例#2
0
        private CommHelper initCallbackCommHelper()
        {
            try
            {
                TcpClient connToHost = new TcpClient(_host, _port);
                CommHelper ch = new CommHelper();
                if (!ch.init(connToHost)) {
                    throw new IOException("Error establishing the communication");
                }

                ch.sendLine("registerProxyCallback " + _applicationID);
                string line = ch.receiveLine();
                if (line.StartsWith("OK")) {
                    return ch;
                }
            }
            catch (Exception) {
                throw;
            }

            return null;
        }
示例#3
0
        private CommHelper initCommHelper()
        {
            try  {
                TcpClient connToHost = new TcpClient(_host, _port);
                CommHelper ch = new CommHelper();
                if ( !ch.init(connToHost) ) {
                    throw new IOException("Error establishing the communication");
                }

                ch.sendLine("registerProxy " + _applicationID);
                string line = ch.receiveLine();
                if (line.StartsWith("OK")) {
                    string[] tokens = line.Split(new char[]{' '});
                    if (tokens.Length > 1)
                    {
                        _applicationID = (ushort)Int32.Parse(tokens[1]);
                    }

                    return ch;
                }
            }
            catch (Exception) {
                throw;
            }

            return null;
        }