Browse Source

현장 변경내용

unque781 6 years ago
parent
commit
e86eb264b3

BIN
Dev/OHV/Assambly/GSG.NET.PLC.dll


BIN
Dev/OHV/Assambly/GSG.NET.PLC.pdb


BIN
Dev/OHV/Assambly/GSG.NET.dll


BIN
Dev/OHV/Assambly/GSG.NET.pdb


+ 136 - 55
Dev/OHV/VehicleControlSystem/ControlLayer/MQ/ZmqManager.cs

@@ -4,6 +4,8 @@ using GSG.NET.ObjectBase;
 using NetMQ;
 using NetMQ.Monitoring;
 using NetMQ.Sockets;
+using OHV.Common.Model;
+using OHV.Common.Shareds;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -12,12 +14,13 @@ using System.Threading.Tasks;
 
 namespace VehicleControlSystem.ControlLayer.MQ
 {
-    public class ZmqManager : SingletonBase<ZmqManager>, IDisposable
+    public class ZmqManager : ControlObjectBase, IDisposable
     {
         Logger logger = Logger.GetLogger();
 
         SubscriberSocket sub = null;
         RequestSocket req = null;
+        ResponseSocket rep = null;
 
         NetMQPoller poller = null;
         NetMQMonitor monitor = null;
@@ -32,42 +35,62 @@ namespace VehicleControlSystem.ControlLayer.MQ
             set { isReqConnected = value; }
         }
 
+        #region Properties
+        private eSteeringState requestSteering;
 
-        private ZmqManager()
+        public eSteeringState RequestSteering
         {
-            NetMQ.NetMQConfig.Cleanup();
+            get { return requestSteering; }
+            set { SetField(ref this.requestSteering, value); }
         }
 
-        public void Init()
+        private bool isDriveMoving;
+
+        public bool IsDriveMoving
         {
+            get { return isDriveMoving; }
+            set { SetField(ref isDriveMoving, value); }
+        }
+
+        private eRoadForm currentLoadForm;
+
+        public eRoadForm CurrentLoadForm
+        {
+            get { return currentLoadForm; }
+            set { SetField(ref currentLoadForm, value); }
+        }
+
+
+
+        #endregion
 
+        public ZmqManager()
+        {
+            NetMQ.NetMQConfig.Cleanup();
         }
 
-        public void CrateClientSocket()
+        public void Init()
         {
-            //pub = new PublisherSocket();
-            //pub.Bind( "tcp://127.0.0.1:5565" );
+            rep = new ResponseSocket();
+            rep.Bind( "tcp://127.0.0.1:5568" );
+            rep.ReceiveReady += Rep_ReceiveReady;
 
             sub = new SubscriberSocket();
             sub.Connect( "tcp://127.0.0.1:5565" );
             sub.Connect( "tcp://127.0.0.1:5566" );
             sub.Subscribe( "" ); //All
-
             sub.ReceiveReady += Sub_ReceiveReady;
 
             req = new RequestSocket();
             this.monitor = new NetMQMonitor( req, "inproc://rep.inproc", SocketEvents.Disconnected | SocketEvents.Connected );
             this.monitor.Connected += ( s, a ) => { this.IsReqConnected = true; };
             this.monitor.Disconnected += ( s, a ) => { this.IsReqConnected = false; };
-
             this.monitor.StartAsync();
 
             req.Connect( "tcp://127.0.0.1:5567" );
 
-            this.poller = new NetMQPoller { this.sub };
+            this.poller = new NetMQPoller { this.sub, this.rep };
             this.poller.RunAsync();
-
-            //this.threadCancel.AddGo( Th_SubPoller );
         }
 
         public void Dispose()
@@ -84,9 +107,80 @@ namespace VehicleControlSystem.ControlLayer.MQ
             this.req.Dispose();
         }
 
+        private void Rep_ReceiveReady( object sender, NetMQSocketEventArgs e )
+        {
+            var ret = e.Socket.ReceiveMultipartStrings();
+            logger.D( $"[rep] - {ret}" );
+
+            if ( ret[0].Equals( "3050" ) )
+            {
+                switch ( ret[1] )
+                {
+                    case "1":
+                        this.RequestSteering = eSteeringState.Left;
+                        break;
+                    case "-1":
+                        this.RequestSteering = eSteeringState.Right;
+                        break;
+                    default:
+                        this.RequestSteering = eSteeringState.None;
+                        break;
+                }
+                rep.SendMoreFrame( "3050" ).SendFrame( "OK" );
+                return;
+            }
+
+            rep.SendFrameEmpty();
+        }
+
         private void Sub_ReceiveReady( object sender, NetMQ.NetMQSocketEventArgs e )
         {
-            logger.I( e.Socket.ReceiveMultipartStrings() );
+            var ret = e.Socket.ReceiveMultipartStrings();
+            logger.I( ret );
+
+            switch ( ret[0] )
+            {
+                case "3050": //TargetSteering
+                    {
+                        //switch ( ret[1] )
+                        //{
+                        //    case "1":
+                        //        this.RequestSteering = eSteeringState.Left;
+                        //        break;
+                        //    case "-1":
+                        //        this.RequestSteering = eSteeringState.Right;
+                        //        break;
+                        //    default:
+                        //        this.RequestSteering = eSteeringState.None;
+                        //        break;
+                        //}
+                    }
+                    break;
+
+                case "111": //0=StartUp, 1=DeviceOpened, 2=DiviceOpenFailed, 3=ManualOP, 4=AutomaticOp, 5=DeviceCloseed, 6=Finished
+                    break;
+
+                case "3010": //진행중의 길의 모양, 0이면 정지 상태
+                    {
+                        var v = ret[1].Split( ';' );
+                        switch ( v[0] )
+                        {
+                            case "1":
+                                //this.RequestSteering = eSteeringState.Left;
+                                break;
+                            case "-1":
+                                //this.RequestSteering = eSteeringState.Right;
+                                break;
+                            default:
+                                //this.RequestSteering = eSteeringState.None;
+                                break;
+                        }
+                    }
+                    break;
+
+                default:
+                    break;
+            }
         }
 
         void Th_SubPoller()
@@ -105,54 +199,41 @@ namespace VehicleControlSystem.ControlLayer.MQ
             }
         }
 
-        public string Request( string topic )
+        bool Request( string topic, string value, out string response )
         {
-            //if ( this.req.TrySendFrame( topic ) )
-            //{
-            //    return string.Empty;
-            //}
-            if ( this.IsReqConnected )
-            {
+            List<string> repll = new List<string>();
+            response = string.Empty;
 
-            }
-            if ( this.req.HasOut )
-            {
-                this.req.SendFrame( topic );
-            }
+            if ( !this.IsReqConnected )
+                return false;
 
-            string outStr = string.Empty;
-            if ( this.req.TryReceiveFrameString( TimeSpan.FromSeconds( 5 ), out outStr ) )
-            {
-                var s = outStr;
-            }
+            if ( !this.req.HasIn )
+                this.req.SendMoreFrame( topic ).SendFrame( value );
+
+            if ( this.req.TryReceiveMultipartStrings( TimeSpan.FromSeconds( 5 ), ref repll ) )
+                return true;
             else
+                return false;
+        }
+
+        internal void SetCurrentSteeringState( eSteeringState state )
+        {
+            string outStr = string.Empty;
+            bool ret = false;
+            switch ( state )
             {
-                this.req.Disconnect( "tcp://127.0.0.1:5567" );
-                this.req.Dispose();
-                this.req = null;
-                LockUtils.Wait( 100 );
-                this.req = new RequestSocket();
-                this.req.Connect( "tcp://127.0.0.1:5567" );
-                return string.Empty;
+                case eSteeringState.None:
+                    ret = this.Request( "set", "3060/0/0", out outStr );
+                    break;
+                case eSteeringState.Left:
+                    ret = this.Request( "set", "3060/0/1", out outStr );
+                    break;
+                case eSteeringState.Right:
+                    ret = this.Request( "set", "3060/0/-1", out outStr );
+                    break;
+                default:
+                    break;
             }
-
-            //var msg = this.req.ReceiveFrameString();
-
-            //if ( this.req.HasIn )
-            //{
-            //    if ( this.req.TryReceiveFrameString( TimeSpan.FromSeconds( 5 ), out outStr ) )
-            //    {
-            //        var s = outStr;
-            //    }
-            //}
-
-            //if ( this.req.Poll( TimeSpan.FromSeconds( 5 ) ) )
-            //{
-            //    return this.req.ReceiveFrameString();
-            //}
-            //else
-            return string.Empty;
         }
-
     }
 }

+ 36 - 37
Dev/OHV/VehicleControlSystem/ControlLayer/Motion/GSIDrive.cs

@@ -1,4 +1,5 @@
 using GSG.NET.Concurrent;
+using GSG.NET.Extensions;
 using GSG.NET.Logging;
 using GSG.NET.Utils;
 using OHV.Common.Model;
@@ -6,6 +7,7 @@ using OHV.Common.Shareds;
 using OHV.SqliteDAL;
 using System;
 using VehicleControlSystem.ControlLayer.DB;
+using VehicleControlSystem.ControlLayer.MQ;
 using VehicleControlSystem.Managers;
 
 namespace VehicleControlSystem.ControlLayer.Drive
@@ -73,6 +75,8 @@ namespace VehicleControlSystem.ControlLayer.Drive
         ThreadCancel threadCancel = new ThreadCancel();
         SqliteManager sql = null;
 
+        ZmqManager zmq = new ZmqManager();
+
         public GSIDrive( SqliteManager sql )
         {
             this.sql = sql;
@@ -80,22 +84,40 @@ namespace VehicleControlSystem.ControlLayer.Drive
 
         public void Init()
         {
-            Redis.Instance.Init();
             this.threadCancel.AddGo( Thread_DriveStateChcker );
             this.threadCancel.AddGo( Thread_Logger );
 
+            zmq.Init();
+            zmq.PropertyChanged += Zmq_PropertyChanged;
+
             //PhysicalCheckupLogger.Instance.Connecte();
         }
 
-        public void Dispose()
+        private void Zmq_PropertyChanged( object sender, System.ComponentModel.PropertyChangedEventArgs e )
         {
-            Redis.Instance.Dispose();
+            var property = sender.GetType().GetProperty( e.PropertyName );
+            var newValue = property.GetValue( sender, null );
+
+            switch ( property.Name )
+            {
+                case "RequestSteering":
+                    {
+                        var v = CastTo<eSteeringState>.From<object>( newValue );
+                        this.ReqSteeringState = v;
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }
 
+        public void Dispose()
+        {
             this.threadCancel.Cancel();
             LockUtils.Wait( 50 );
             this.threadCancel.StopWaitAll();
 
-            PhysicalCheckupLogger.Instance.Dispose();
+            zmq.Dispose();
         }
 
         void Thread_DriveStateChcker()
@@ -107,10 +129,7 @@ namespace VehicleControlSystem.ControlLayer.Drive
                 try
                 {
                     LockUtils.Wait( 10 );
-                    this.GetReqSteeringState();
-
-                    this.CurrentTag = Redis.Instance.GetCurrentPoint();
-
+                    //this.GetReqSteeringState();
                     //if (Redis.Instance.GetDriveMove() )
                     //{
                     //    this.LoggingState();
@@ -125,21 +144,6 @@ namespace VehicleControlSystem.ControlLayer.Drive
             logger.D( "[Drive] - Thread Drive State Checker Disposed" );
         }
 
-        bool isLoggingStart = false;
-        public bool IsloggingStart
-        {
-            get => this.isLoggingStart;
-            set
-            {
-                if ( SetField( ref this.isLoggingStart, value ) )
-                {
-                    if ( value )
-                        PhysicalCheckupLogger.Instance.SetPLCStartDrive();
-                    else
-                        PhysicalCheckupLogger.Instance.ResetPLCStartDrive();
-                }
-            }
-        }
         void Thread_Logger()
         {
             while ( !this.threadCancel.Canceled )
@@ -147,14 +151,6 @@ namespace VehicleControlSystem.ControlLayer.Drive
                 try
                 {
                     LockUtils.Wait( 10 );
-
-                    if ( Redis.Instance.GetDriveMove() )
-                    {
-                        //this.IsloggingStart = true;
-                        //this.LoggingState();
-                    }
-                    else
-                        this.IsloggingStart = false;
                 }
                 catch ( Exception e )
                 {
@@ -208,6 +204,11 @@ namespace VehicleControlSystem.ControlLayer.Drive
             { }
         }
 
+        public void SetCurrentSteeringState(eSteeringState state )
+        {
+            this.zmq.SetCurrentSteeringState( state );
+        }
+
         bool IsDriveFault()
         {
             var ret = Redis.Instance.GetSystemState();
@@ -219,7 +220,6 @@ namespace VehicleControlSystem.ControlLayer.Drive
 
         public void SetDriveOperationMode( eOperatationMode mode )
         {
-
             if ( mode == eOperatationMode.ManualMode )
                 Redis.Instance.SetSystemOperation( 3 );
             else if ( mode == eOperatationMode.AutoMode )
@@ -250,10 +250,10 @@ namespace VehicleControlSystem.ControlLayer.Drive
 
             //ToDo: 이동 명령 실행.
             int result = 0;
-            if (! Redis.Instance.RouteMapMoveTo( point ) )
-            {
-                //Todo: Error 처리
-            }
+            //if (! Redis.Instance.RouteMapMoveTo( point ) )
+            //{
+            //    //Todo: Error 처리
+            //}
 
             int waitTime = 10000;
             long st = SwUtils.CurrentTimeMillis;
@@ -321,7 +321,6 @@ namespace VehicleControlSystem.ControlLayer.Drive
             return true;
         }
 
-
 #region Test Method
 
 #endregion

+ 3 - 1
Dev/OHV/VehicleControlSystem/ControlLayer/Vehicle.cs

@@ -121,7 +121,7 @@ namespace VehicleControlSystem.ControlLayer
             {
                 if ( SetField( ref this.steeringState, value ) )
                 {
-                    Redis.Instance.SetActualSteeringPos( value );
+                    this.drive.SetCurrentSteeringState( value );    
                 }
             }
         }
@@ -212,6 +212,7 @@ namespace VehicleControlSystem.ControlLayer
         }
 
         public bool IsMoving { get => this.drive.IsDriveMoving(); }
+
         #region Battery Property
 
         double batteryVoltage;
@@ -294,6 +295,7 @@ namespace VehicleControlSystem.ControlLayer
             set { this.SetField( ref this.batteryIsConnect, value ); }
         }
         #endregion
+
         public bool IsError { get; set; }
 
         public SubCmd CurrentSubCommand { get; private set; }

+ 1 - 1
Dev/OHV/VehicleControlSystem/Managers/RouteManager.cs

@@ -18,7 +18,7 @@ namespace VehicleControlSystem.Managers
         public List<segment> Segments = new List<segment>();
         public List<point> Points = new List<point>();
 
-        public RouteManager( SqliteManager sql)
+        public RouteManager( SqliteManager sql )
         {
             this.sql = sql;
 

BIN
Dev/OHVDriveLogger/OHVDriveLogger/.vs/OHVDriveLogger/v16/Server/sqlite3/storage.ide


BIN
Dev/OHVDriveLogger/OHVDriveLogger/.vs/OHVDriveLogger/v16/Server/sqlite3/storage.ide-shm


BIN
Dev/OHVDriveLogger/OHVDriveLogger/.vs/OHVDriveLogger/v16/Server/sqlite3/storage.ide-wal


+ 7 - 17
Dev/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger/FTPLogger.cs

@@ -13,17 +13,11 @@ namespace OHVDriveLogger
     {
         public void FTPUpload()
         {
-            using ( var ftp = new FtpClient( "127.0.0.1", "ftptest", "ftptest" ) )
+            using ( var ftp = new FtpClient( "192.168.127.123" ) )
             {
                 ftp.Connect();
-
-                // upload a folder and all its files
-                ftp.UploadDirectory( @"C:\website\videos\", @"/public_html/videos", FtpFolderSyncMode.Update );
-
-                // upload a folder and all its files, and delete extra files on the server
-                //ftp.UploadDirectory( @"C:\website\assets\", @"/public_html/assets", FtpFolderSyncMode.Mirror );
+                ftp.UploadDirectory( @"C:\LOG\FTP\", @"\LOG\", FtpFolderSyncMode.Update );
             }
-
         }
 
         public void FTPDownload()
@@ -35,16 +29,12 @@ namespace OHVDriveLogger
                 // download a folder and all its files
                 ftp.DownloadDirectory( @"C:\LOG\FTP\", @"/0_CARD/log0/", FtpFolderSyncMode.Update );
 
-                //ftp.DeleteFile( "/0_CARD/log0" );
-            }
-        }
+                if ( !ftp.DirectoryExists( @"/0_CARD/log0/" ) )
+                    return;
+                if ( !ftp.FileExists( @"/0_CARD/log0/" ) )
+                    return;
 
-        void FTPServerDeleteFile()
-        {
-            using ( var ftp = new FtpClient( "192.168.0.20", "KV", "1234" ) )
-            {
-                ftp.Connect();
-                ftp.DeleteDirectory( "/0_CARD/log0/" );
+                ftp.DeleteDirectory( @"/0_CARD/log0/" );
             }
         }
 

+ 13 - 12
Dev/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger/FormMain.Designer.cs

@@ -30,7 +30,7 @@
         {
             this.lblPLCCommState = new System.Windows.Forms.Label();
             this.label55 = new System.Windows.Forms.Label();
-            this.button1 = new System.Windows.Forms.Button();
+            this.btnBit = new System.Windows.Forms.Button();
             this.SuspendLayout();
             // 
             // lblPLCCommState
@@ -60,26 +60,27 @@
             this.label55.Text = "PLC COMM";
             this.label55.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // button1
+            // btnBit
             // 
-            this.button1.Location = new System.Drawing.Point(154, 20);
-            this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(124, 28);
-            this.button1.TabIndex = 13;
-            this.button1.Text = "button1";
-            this.button1.UseVisualStyleBackColor = true;
-            this.button1.Click += new System.EventHandler(this.button1_Click);
+            this.btnBit.Location = new System.Drawing.Point(104, 12);
+            this.btnBit.Name = "btnBit";
+            this.btnBit.Size = new System.Drawing.Size(124, 48);
+            this.btnBit.TabIndex = 13;
+            this.btnBit.Text = "PLC LOG ON";
+            this.btnBit.UseVisualStyleBackColor = true;
+            this.btnBit.Click += new System.EventHandler(this.button1_Click);
             // 
             // FormMain
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.SystemColors.ActiveBorder;
-            this.ClientSize = new System.Drawing.Size(419, 72);
-            this.Controls.Add(this.button1);
+            this.ClientSize = new System.Drawing.Size(245, 72);
+            this.Controls.Add(this.btnBit);
             this.Controls.Add(this.lblPLCCommState);
             this.Controls.Add(this.label55);
             this.Name = "FormMain";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.Text = "OHV Drive Logger";
             this.ResumeLayout(false);
 
@@ -89,7 +90,7 @@
 
         public System.Windows.Forms.Label lblPLCCommState;
         private System.Windows.Forms.Label label55;
-        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.Button btnBit;
     }
 }
 

+ 18 - 6
Dev/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger/FormMain.cs

@@ -1,5 +1,6 @@
 using GSG.NET.Logging;
 using GSG.NET.PLC;
+using GSG.NET.PLC.Keyence;
 using GSG.NET.PLC.KNC;
 using System;
 using System.Collections.Generic;
@@ -18,7 +19,7 @@ namespace OHVDriveLogger
         Logger logger = Logger.GetLogger();
         KncManager plc = new KncManager();
         ZmqManager zmp = new ZmqManager();
-        
+
         public FormMain()
         {
             InitializeComponent();
@@ -30,7 +31,6 @@ namespace OHVDriveLogger
         private void FormMain_FormClosing( object sender, FormClosingEventArgs e )
         {
             this.plc.Disconnect();
-
             this.zmp.Dispose();
         }
 
@@ -38,11 +38,11 @@ namespace OHVDriveLogger
         {
             this.plc.Config.Id = "KV8000";
             this.plc.Config.IpAddress = "192.168.0.20";
-            this.plc.Config.Port = 8501; //5000
-            this.plc.Config.MonitorInterval = 500;
+            this.plc.Config.Port = 5000; //5000
+            this.plc.Config.MonitorInterval = 1000;
 
             var grpB = new KncGroup { Device = KncDevice.MR, Name = "MR" };
-            grpB.AddBitBlock( new KncBitBlock { Name = "DRIVE_LOGGING_ONOFF",Address=100, SubNo=0 } );
+            grpB.AddBitBlock( new KncBitBlock { Name = $"DRIVE_LOGGING_ONOFF", Address = 16, SubNo = 0 } );
 
             this.plc.AddGroup( grpB );
 
@@ -71,11 +71,23 @@ namespace OHVDriveLogger
         private void Plc_OnBitChanged( GSG.NET.PLC.Model.BitBlock block )
         {
             logger.I( $"[Bit Change] - {block.Name} / {block.IsBitOn}" );
+
+            if ( block.Name.Equals( "DRIVE_LOGGING_ONOFF" ) )
+            {
+                if ( block.IsBitOn )
+                    this.btnBit.Text = "PLC LOG On";
+                else
+                    this.btnBit.Text = "PLC LOG Off";
+            }
         }
 
         private void button1_Click( object sender, EventArgs e )
         {
-            this.zmp.Request("Hello");
+            var bit = plc.ReadBit( "DRIVE_LOGGING_ONOFF" );
+            if ( bit.IsBitOn )
+                plc.WriteBit( "DRIVE_LOGGING_ONOFF", false );
+            else
+                plc.WriteBit( "DRIVE_LOGGING_ONOFF", true );
         }
     }
 }

+ 2 - 2
Dev/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger.csproj

@@ -49,7 +49,8 @@
     <Reference Include="GSG.NET">
       <HintPath>..\..\..\OHV\Assambly\GSG.NET.dll</HintPath>
     </Reference>
-    <Reference Include="GSG.NET.PLC">
+    <Reference Include="GSG.NET.PLC, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\..\OHV\Assambly\GSG.NET.PLC.dll</HintPath>
     </Reference>
     <Reference Include="NetMQ">
@@ -119,7 +120,6 @@
   <ItemGroup>
     <None Include="App.config" />
   </ItemGroup>
-  <ItemGroup />
   <ItemGroup>
     <None Include="Config\log4net.xml">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>

+ 7 - 42
Dev/OHVDriveLogger/OHVDriveLogger/OHVDriveLogger/ZmqManager.cs

@@ -31,7 +31,6 @@ namespace OHVDriveLogger
             set { isReqConnected = value; }
         }
 
-
         public ZmqManager()
         {
             NetMQ.NetMQConfig.Cleanup();
@@ -53,7 +52,6 @@ namespace OHVDriveLogger
             this.monitor = new NetMQMonitor( req, "inproc://rep.inproc", SocketEvents.Disconnected | SocketEvents.Connected );
             this.monitor.Connected += ( s, a ) => { this.IsReqConnected = true; };
             this.monitor.Disconnected += ( s, a ) => { this.IsReqConnected = false; };
-
             this.monitor.StartAsync();
 
             req.Connect( "tcp://127.0.0.1:5567" );
@@ -99,53 +97,20 @@ namespace OHVDriveLogger
             }
         }
 
-        public string Request( string topic )
+        bool Request( string topic, out string response )
         {
-            //if ( this.req.TrySendFrame( topic ) )
-            //{
-            //    return string.Empty;
-            //}
+            response = string.Empty;
+
             if ( this.IsReqConnected )
-            {
+                return false;
 
-            }
             if ( this.req.HasOut )
-            {
                 this.req.SendFrame( topic );
-            }
 
-            string outStr = string.Empty;
-            if ( this.req.TryReceiveFrameString( TimeSpan.FromSeconds( 5 ), out outStr ) )
-            {
-                var s = outStr;
-            }
+            if ( this.req.TryReceiveFrameString( TimeSpan.FromSeconds( 5 ), out response ) )
+                return true;
             else
-            {
-                this.req.Disconnect( "tcp://127.0.0.1:5567" );
-                this.req.Dispose();
-                this.req = null;
-                LockUtils.Wait( 100 );
-                this.req = new RequestSocket();
-                this.req.Connect( "tcp://127.0.0.1:5567" );
-                return string.Empty;
-            }
-
-            //var msg = this.req.ReceiveFrameString();
-
-            //if ( this.req.HasIn )
-            //{
-            //    if ( this.req.TryReceiveFrameString( TimeSpan.FromSeconds( 5 ), out outStr ) )
-            //    {
-            //        var s = outStr;
-            //    }
-            //}
-
-            //if ( this.req.Poll( TimeSpan.FromSeconds( 5 ) ) )
-            //{
-            //    return this.req.ReceiveFrameString();
-            //}
-            //else
-                return string.Empty;
+                return false;
         }
     }
 }