Ejemplo n.º 1
0
        private void OpenSocket()
        {
            if (_client != null)
            {
                return;
            }

            SocketClientConfig cfg = new SocketClientConfig();

            cfg.SocketClientType = this.comboBoxType.SelectedItem as string;
            cfg.IPAddress        = _serverIP;
            cfg.Port             = _serverPort;

            _client = SocketClientFactory.Create(cfg);

            if (_client != null && _client.Open())
            {
                this.buttonOpen.Enabled   = false;
                this.buttonSend.Enabled   = true;
                this.buttonClose.Enabled  = true;
                this.comboBoxType.Enabled = false;
            }
            else
            {
                this.buttonOpen.Enabled   = true;
                this.buttonSend.Enabled   = false;
                this.buttonClose.Enabled  = false;
                this.comboBoxType.Enabled = true;

                MessageBox.Show(this, "Open socket failed. \r\n\r\n"
                                + SocketLogMgt.LastErrorInfor, this.Text,
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 2
0
        /**
         * Run this class passing a host as first argument  otherwise
         * HOST_ADDRESS constant will be used
         */
        static void Main(string[] args)
        {
            var hostAddress = HOST_ADDRESS;

            if (args.Length > 0)
            {
                hostAddress = args[0];
            }

            // create a new websocket client
            var myWebsocketClient = SocketClientFactory.buildSimpleClient(hostAddress);

            // make it work
            myWebsocketClient.connect();
        }
Ejemplo n.º 3
0
        private void AutoSend()
        {
            decimal count = this.numericUpDownAutoSendTimes.Value;

            if (count < 1)
            {
                return;
            }

            SocketClientConfig cfg = new SocketClientConfig();

            cfg.SocketClientType = this.comboBoxType.SelectedItem as string;
            cfg.IPAddress        = _serverIP;
            cfg.Port             = _serverPort;

            IClient cln = SocketClientFactory.Create(cfg);

            for (decimal i = 1; i <= count; i++)
            {
                this.labelTimesCounter.Text = string.Format("{0}/{1}", i, count);

                if (cln == null || !cln.Open())
                {
                    MessageBox.Show(this, "Open socket failed. \r\n\r\n"
                                    + SocketLogMgt.LastErrorInfor, this.Text,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                if (!SendMessages(cln))
                {
                    break;
                }

                if (!cln.Close())
                {
                    MessageBox.Show(this, "Close socket failed. \r\n\r\n"
                                    + SocketLogMgt.LastErrorInfor, this.Text,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }
            }
        }
Ejemplo n.º 4
0
 public HL7OutboundControler(EntityImpl entity)
 {
     _entity      = entity;
     _client      = SocketClientFactory.Create(_entity.Context.ConfigMgr.Config.SocketConfig);
     _transformer = XmlTransformerFactory.CreateTransformer(_entity.Context.ConfigMgr.Config.HL7XMLTransformerType, _entity.Context.Log);
 }