示例#1
0
        /// <summary>
        /// The HandleIpc_EventOpened method is invoked in response
        /// to the IPC endpoint establishing a connection to the peer
        /// system that the service is interacting with.
        /// </summary>
        /// <param name="sender">
        /// The VfxIpcEndpoint that dispatched the event.
        /// </param>
        /// <param name="args">
        /// The details associated with the event.
        /// </param>
        private void HandleIpc_EventOpened(object sender, VfxIpcEventArgs args)
        {
            lock (_synch)
            {
                // REC: The IPC session is now established.
                _ipcEstablished = true;

                // REC: Adjust the service's current status:
                _serviceStatus = VfxFixServiceStatus.Service_Status_Opened;
                // REC: Dispatch the update to the service's subscribers:
                EventHandler <VfxFixServiceEventArgs> tmpDispatch_Update = EventDispatch;
                if (tmpDispatch_Update != null)
                {
                    VfxFixServiceEventArgs tmpArgs = new VfxFixServiceEventArgs(VfxFixServiceEventTypes.Event_Service_Updated, _serviceStatus);
                    tmpDispatch_Update(this, tmpArgs);
                }

                // REC: Retrieve the version definition from the version
                // definition registry and determine what kind of session
                // needs to be created in order to handle the connection:
                IVfxFixVxRegistry vxRegistry = this._localServices.GetService(typeof(IVfxFixVxRegistry)) as IVfxFixVxRegistry;


                // REC: Create a new instance of a FIX session to handle
                // the communication between the server and the peer:
                IVfxFixSession fixSession = null;

                // REC: Check the version definition in order to tell if
                // this is a FIX 4.x or FIX 5.x service:
                VfxFixVxRecord vxRecord = vxRegistry.Get(this._sxVersion);
                if (vxRecord.Layer.ToLower().CompareTo("combined") == 0)
                {
                    fixSession = new VfxFix4xClientSession();
                }
                else
                {
                    fixSession = new VfxFix5xClientSession();
                }


                _fixSession = fixSession;

                // REC: Initialize the session:
                _fixSession.Init(this._localServices, this);

                // REC: Construct an instance of the session wrapper
                // for the FIX application and bind it to the session
                // implementation that has been created:
                _appSession = new VfxFixClientSession(_fixSession);

                // REC: Notify the FIX session implementation that it
                // has been connected to a peer system:
                _fixSession.HandleConnect();
            }
        }
示例#2
0
        /// <summary>
        /// The HandleIpc_EventOpened method is invoked in response
        /// to the IPC endpoint establishing a connection to the peer
        /// system that the service is interacting with.
        /// </summary>
        /// <param name="sender">
        /// The VfxIpcEndpoint that dispatched the event.
        /// </param>
        /// <param name="args">
        /// The details associated with the event.
        /// </param>
        private void HandleIpc_EventOpened(object sender, VfxIpcEventArgs args)
        {
            lock (_synch)
            {
                // REC: The IPC session is now established.
                _ipcEstablished = true;

                // REC: Adjust the service's current status:
                _serviceStatus = VfxFixServiceStatus.Service_Status_Opened;
                // REC: Dispatch the update to the service's subscribers:
                EventHandler<VfxFixServiceEventArgs> tmpDispatch_Update = EventDispatch;
                if (tmpDispatch_Update != null)
                {
                    VfxFixServiceEventArgs tmpArgs = new VfxFixServiceEventArgs(VfxFixServiceEventTypes.Event_Service_Updated, _serviceStatus);
                    tmpDispatch_Update(this, tmpArgs);
                }

                // REC: Retrieve the version definition from the version
                // definition registry and determine what kind of session
                // needs to be created in order to handle the connection:
                IVfxFixVxRegistry vxRegistry = this._localServices.GetService(typeof(IVfxFixVxRegistry)) as IVfxFixVxRegistry;

                // REC: Create a new instance of a FIX session to handle
                // the communication between the server and the peer:
                IVfxFixSession fixSession = null;

                // REC: Check the version definition in order to tell if
                // this is a FIX 4.x or FIX 5.x service:
                VfxFixVxRecord vxRecord = vxRegistry.Get(this._sxVersion);
                if (vxRecord.Layer.ToLower().CompareTo("combined") == 0)
                {
                    fixSession = new VfxFix4xClientSession();
                }
                else
                {
                    fixSession = new VfxFix5xClientSession();
                }

                _fixSession = fixSession;

                // REC: Initialize the session:
                _fixSession.Init(this._localServices, this);

                // REC: Construct an instance of the session wrapper
                // for the FIX application and bind it to the session
                // implementation that has been created:
                _appSession = new VfxFixClientSession(_fixSession);

                // REC: Notify the FIX session implementation that it
                // has been connected to a peer system:
                _fixSession.HandleConnect();
            }
        }