Closed RaymondCui21 closed 5 years ago
Check to see in netstat it port 7878 on 127.0.0.1 is bound? Make sure it isn’t the ipv6 port. I thought we were binding to 0.0.0.0 which is ipv4 any, but don’t remember.
(Sent from mobile)
On Jun 12, 2019, at 22:42, Raymond CUI notifications@github.com wrote:
I am using the file "cppagent_win32_Vista_1.4.0.10_bin" on Window 10. I used Powershell Administrator right and run simulator on one terminal: ruby simulator.rb -p 7878 .\VMC-3Axis.xml Run agent debug mode on anther terminal: .\agent.exe debug .\agent.cfg Problem is that simulator keeps waiting for connection and agent failed to connect. Using telnet to test 7878 port and display: Connecting To 127.0.0.1...Could not open connection to the host, on port 7878: Connect failed
Besides, I also turned off Firewalls:
Anyone can help! Thank you. Kind regards, Raymond
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
@wsobel Thank you very much, Will. I ran the simulator and test with the command: netstat -na | findStr "7878". Nothing happened. Then I ran the agent and using netstat to see 5000, and shown:
TCP 0.0.0.0:5000 0.0.0.0:0 Listening UDP 0.0.0.0:5000 .
It seems that simulator does not setup port successfully, is it right?
You’re using the wrong script. The one you should be using is run_scenario.rb.
You also should not feed in the xml configuration device file, that is for the agent.
Run as follows:
ruby run_scenario.rb VMC-3Axis-Log.txt
It by default binds to port 7878
simulator.rb is provides a single line entry for adapter simulation.
That script is run ruby simulator.rb 7878
(Sent from mobile)
On Jun 12, 2019, at 23:10, Raymond CUI notifications@github.com wrote:
@wsobel Thank you very much, Will. I ran the simulator and test with the command: netstat -na | findStr "7878". Nothing happened. Then I ran the agent and using netstat to see 5000, and shown:
TCP 0.0.0.0:5000 0.0.0.0:0 Listening UDP 0.0.0.0:5000 .
It seems that simulator does not setup port successfully, is it right?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
I tried "ruby run_scenario.rb VMC-3Axis-Log.txt" but shown some errors.
I tried "run ruby simulator.rb 7878" and connection is successful.
My ruby version is 2.5.5 64bit, uninstalled 64 and installed 86: ruby 2.5.5p157 (2019-03-15 revision 67260) [i386-mingw32] Gem version is 2.7.6.2 The same error occurred in both versions.
Change in the option parser library in later versions of ruby. Change to Sting from OptionParser::String
(Sent from mobile)
On Jun 12, 2019, at 23:30, Raymond CUI notifications@github.com wrote:
I tried this simulator but shown some errors.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@wsobel Installed the latest version of Ruby 2.6.3 i386 for Windows and modified the code to Sting from OptionParser::String in run_scenario.rb The same error occurred (also happened in Ubuntu 18.04): Could you please give some instruction to change "option parser library" in Ruby? I listed the paths of Ruby for your reference. Thank you very much.
I’m traveling now and have not had a chance to check. Should get to it in a day.
(Sent from mobile)
On Jun 14, 2019, at 03:54, Raymond CUI notifications@github.com wrote:
@wsobel Installed the latest version of Ruby 2.6.3 i386 for Windows and modified the code to Sting from OptionParser::String in run_scenario.rb The same error occurred:
Could you please give some instruction to change "option parser library" in Ruby? I listed the paths of Ruby for your reference. Thank you very much.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Rmoved OptionParser:: before String and tested with ruby 2.5. See latest
@wsobel Thank you very much for the prompt reply.
Yes, the error is removed after removed "OptionParser:: ". The agent is not able to connect the simulator as shown below:
The simulator showed the message:
(Testing environment: ruby 2.6.3p62 (2019-04-16 revision 67580) [i386-mingw32], Win10 )
That is just the way ruby logs the server. I don’t know why you are disconnecting immediately. That seems odd.
You can try telneting to the run_simulator.rb adapter on 127.0.0.1 7878 and see if it disconnects.
(Sent from mobile)
On Jun 15, 2019, at 00:07, Raymond CUI notifications@github.com wrote:
@wsobel Thank you very much for the prompt reply. Yes, the error is removed after removed "OptionParser:: ". The agent is not able to connect the simulator as shown below:
The simulator showed the message: TCPServer:0x0512a390 which seems that the TCP Server address is incorrect, like a pointer address. (Testing environment: ruby 2.6.3p62 (2019-04-16 revision 67580) [i386-mingw32], Win10 )
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
It showed TIME_WAIT and connect failed.
What’s in your log file? Is it empty?
(Sent from mobile)
On Jun 15, 2019, at 01:19, Raymond CUI notifications@github.com wrote:
It showed TIME_WAIT and connect failed.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Sorry, just came back from a trip.
Yes, the log file is empty.
Just found one thing that the simulator stays at the state of "Waiting on #
The vmc... log file needs data.
(Sent from mobile)
On Jun 15, 2019, at 14:06, Raymond CUI notifications@github.com wrote:
Sorry, just came back from a trip. Yes, the log file is empty. Just found one thing that the simulator stays at the state of "Waiting on #TCPServer:0x0509ad68 7878", once executes agent program, the state of the simulator changes to "Received * PING, responding with pong" and quit the program.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@wsobel Sorry, I did not notice the log file was empty, but it was filled with data before. It works well on Win7, Win10 and Ubuntu 18.04 now. Thank you very much, William. I left all my steps to run the simulators on Ubuntu 18.04 below for the following learners:
• Create testing Ubuntu 18.04 OS (Install VirtualBox and download Ubuntu 18.04 image) • Following steps: (refer to: Installing C++ Agent on Ubuntu) o sudo apt-get update o sudo apt-get install libxml2 libxml2-dev cmake git libcppunit-dev build-essential screen ruby curl o mkdir -p ~/agent/build o cd ~/agent o git clone https://github.com/mtconnect/cppagent.git o cd cppagent o git submodule init o git submodule update o mv -f schema schemas o cd .. o cd build o cmake -D CMAKE_BUILD_TYPE=Release ../cppagent/ o make o sudo cp agent/agent /usr/local/bin o sudo mkdir -p /etc/mtconnect/agent /etc/mtconnect/adapter o cd ~/agent/cppagent o sudo cp -r styles schemas simulator/VMC-3Axis.xml /etc/mtconnect/agent o sudo cp simulator/VMC-3Axis-Log.txt simulator/run_scenario.rb /etc/mtconnect/adapter o Configure the Agent with copy the script codes o agent debug /etc/mtconnect/agent/agent.cfg o Can not run Upstart scripts since Upstart is not available after Ubuntu 14.04 (eg: Ubuntu 16.04 and Ubuntu 18.04) o Start agent with the command: /usr/local/bin/agent run /etc/mtconnect/agent/agent.cfg o Start simulator with the command: ruby /etc/mtconnect/adapter/run_scenario.rb -l /etc/mtconnect/adapter/VMC-3Axis-Log.txt
Windows 7/10:
• Config agent.cfg file under the bin folder: \bin\ Devices = C:\etc\cppagent_win32_Vista_1.3.0.17_bin\simulator\VMC-3Axis.xml • Run Agent with Run or Debug mode Run mode with the following command: .\agent.exe run .\agent.cfg Debug mode with the following command: .\agent.exe debug .\agent.cfg • Run Simulator with log file Install Ruby installer on Windows https://rubyinstaller.org/
When you install the agent it will automatically run as a windows service when the machine starts or if you open Services and the start the service manually.
(Sent from mobile)
On Jun 17, 2019, at 04:43, Raymond CUI notifications@github.com wrote:
Windows 7/10:
Download agent file cppagent_win32_Vista_1.4.0.10_bin.zip from https://github.com/mtconnect/cppagent/releases Unzip it and remember the directory X, eg: create a folder etc and move it into the folder etc C:\etc\cppagent_win32_Vista_1.3.0.17_bin\ Open Command Prompt with Administrative rights Change to the directory X with the command: cd X/bin/ Run the following command: agent.exe install agent.cfg • Config agent.cfg file under the bin folder: \bin\ Devices = C:\etc\cppagent_win32_Vista_1.3.0.17_bin\simulator\VMC-3Axis.xml • Run Agent with Run or Debug mode Run mode with the following command: agent.exe run agent.cfg Debug mode with the following command: agent.exe debug agent.cfg • Run Simulator with log file Install Ruby installer on Windows https://rubyinstaller.org/
Modify the simulator ruby file under the directory ../simulator/run_scenario.rb . Change OptionParser:: String to String Open (Command Prompt/PowerShell) with Administrative rights cd to the directory ../simulator/ Run the simulator with the following command: ruby run_scenario.rb VMC-3Axis-Log.txt (make sure VMC-3Axis-Log.txt is not empty, otherwise the simulator stops after agent runs) — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@wsobel Do you mean install the agent is that execute the command to install the agent at the powershell ( agent.exe install agent.cfg ) ? I run the simulator before start the agent, the localhost:5000/current is empty and the simulator keeps waiting for connection, do I need to config the agent as an automatic windows service ?
Also, while keeping the simulator and Agent running, the trace data is automatically stored in every 10 MB log file in Ubuntu, but stored all data in one large file in Windows after stop the agent, is it intended in Windows? Is it better to split data into small files?
@RaymondCui21 I followed your steps listed above, but still could not get it working on windows. Here are the messages:
Any ideas? Much appreciated. My skype is: yuqian.m.lu, if it is easier to exchange ideas via skype.
Yuqian
@michaell-nz Hi Yuqian, Have you tried Powershell? I am using it but not command prompt.
I am using the file "cppagent_win32_Vista_1.4.0.10_bin" on Window 10. I used Powershell Administrator right and run simulator on one terminal: ruby simulator.rb -p 7878 .\VMC-3Axis-Log.txt or ruby simulator.rb -p 7878 .\VMC-3Axis.XML
Run agent debug mode on anther terminal: .\agent.exe debug .\agent.cfg
Problem is that simulator keeps waiting for connection and agent failed to connect.
Using telnet to test 7878 port and display:
Connecting To 127.0.0.1...Could not open connection to the host, on port 7878: Connect failed
Besides, I also turned off Firewalls:
Agent.cfg file is attached. agent.zip
Anyone can help! Thank you. Kind regards, Raymond