VOLTTRON / volttron

VOLTTRON Distributed Control System Platform
https://volttron.readthedocs.io/
Other
458 stars 216 forks source link

No connection could be made because the target machine actively refused it #2723

Open nitin-barthwal opened 3 years ago

nitin-barthwal commented 3 years ago

Description of Issue

I am trying trying to establish communication b/w Volttron Agent and a Client running on windows Machine. Both Machines are currently in same Local Network.

My ultimate goal is to run a Simulation (similar to energy Plus) in Windows Environment and connect it to Voltton bus using a Volttron Agent named Apache. The communication b/w the two will be done using Sockets(Client-Server).

I am not able to connect to the server running on Volttron agent (RPi) with the python program in another Machine and getting an error - "[WinError 10061] No connection could be made because the target machine actively refused it"

Steps to Reproduce

More Info- Ip addr of RPi (Server) is '192.168.0.17'

In Server (Apache_integration.py) I mentioned
self.host = '192.168.0.17' self.port = 5005 self.sock.bind((self.host, self.port))

Server Execution is struck indefinitely at recv() Method .

Additional Details

------ Client Logs------ line 8, in clientSocket.connect((TCP_IP, TCP_PORT))ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

------ Volttron (Server) Logs------ 2021-07-16 08:52:03,354 (apacheagent-0.1 23666) volttron.platform.vip.agent.core INFO: Connected to platform: router: 0ef3e69d-9f94-4c40-8301-c7a78333bac3 version: 1.0 identity: platform.actuator 2021-07-16 08:52:03,423 (apacheagent-0.1 23666) main DEBUG: Method: start 2021-07-16 08:52:03,424 (apacheagent-0.1 23666) integrations.apache_integration DEBUG: Int Method: register_inputs 2021-07-16 08:52:03,425 (apacheagent-0.1 23666) main DEBUG: Method: subscribe 2021-07-16 08:52:03,426 (apacheagent-0.1 23666) main INFO: subscribed to PNNL/BUILDING1/AHU1/VAV102 2021-07-16 08:52:03,427 (apacheagent-0.1 23666) main INFO: subscribed to PNNL/BUILDING1/AHU1/VAV118 2021-07-16 08:52:03,428 (apacheagent-0.1 23666) main INFO: subscribed to PNNL/BUILDING1/LIGHTING/ZONE136 2021-07-16 08:52:03,429 (apacheagent-0.1 23666) main DEBUG: Method: clear_last_update 2021-07-16 08:52:03,430 (apacheagent-0.1 23666) integrations.apache_integration DEBUG: Int Method: start_simulation 2021-07-16 08:52:03,431 (apacheagent-0.1 23666) integrations.apache_integration DEBUG: Int Method: start_socket_server 2021-07-16 08:52:03,432 (apacheagent-0.1 23666) integrations.apache_integration DEBUG: Int Method: connect to : 192.168.0.17 on port: 5005 ! 2021-07-16 09:05:26,385 () volttron.platform.auth INFO: AUTH: After authenticate user id: control.connection, b'0ef3e69d-9f94-4c40-8301-c7a78333bac3' 2021-07-16 09:05:26,386 () volttron.platform.auth INFO: authentication success: userid=b'0ef3e69d-9f94-4c40-8301-c7a78333bac3' domain='vip', address='localhost:1000:1000:23830', mechanism='CURVE', credentials=['ovpetUz6u_RkmcH433-2z37iZldQeWMU_F_SbLv1UGI'], user='control.connection' 2021-07-16 09:05:26,471 (apacheagent-0.1 23666) ERROR: Traceback (most recent call last): 2021-07-16 09:05:26,471 (apacheagent-0.1 23666) ERROR: File "src/gevent/greenlet.py", line 854, in gevent._gevent_cgreenlet.Greenlet.run 2021-07-16 09:05:26,472 (apacheagent-0.1 23666) ERROR: File "/home/pi/.volttron/agents/c5c28ed6-8dbd-4170-9c94-c27602032932/apacheagent-0.1/apache/agent.py", line 147, in start 2021-07-16 09:05:26,473 (apacheagent-0.1 23666) ERROR: self.Apache_sim.start_simulation() 2021-07-16 09:05:26,473 (apacheagent-0.1 23666) ERROR: File "/home/pi/volttron/integrations/apache_integration.py", line 144, in start_simulation 2021-07-16 09:05:26,475 (apacheagent-0.1 23666) ERROR: self.start_socket_server() 2021-07-16 09:05:26,475 (apacheagent-0.1 23666) ERROR: File "/home/pi/volttron/integrations/apache_integration.py", line 135, in start_socket_server 2021-07-16 09:05:26,476 (apacheagent-0.1 23666) ERROR: self.socket_server.connect() 2021-07-16 09:05:26,477 (apacheagent-0.1 23666) ERROR: File "/home/pi/volttron/integrations/apache_integration.py", line 293, in connect 2021-07-16 09:05:26,480 (apacheagent-0.1 23666) ERROR: self.sock.bind(('', self.port)) 2021-07-16 09:05:26,481 (apacheagent-0.1 23666) ERROR: OSError: [Errno 98] Address already in use 2021-07-16 09:05:26,481 (apacheagent-0.1 23666) ERROR: 2021-07-16T07:52:03Z <Greenlet at 0xb5130300: <bound method ApacheAgent.start of <main.ApacheAgent object at 0xb51960f0>>(<volttron.platform.vip.agent.core.ZMQCore object a)> failed with OSError 2021-07-16 09:05:26,482 (apacheagent-0.1 23666) ERROR: 2021-07-16 09:05:26,470 (apacheagent-0.1 23666) main DEBUG: Method: onstop 2021-07-16 09:05:26,471 (apacheagent-0.1 23666) integrations.apache_integration DEBUG: Int Method: stop_simulation 2021-07-16 09:05:26,471 (apacheagent-0.1 23666) integrations.apache_integration DEBUG: Int Method: stop files.zip

shwethanidd commented 3 years ago

@nitin-barthwal: Let's chat about this error and the follow-on sim work. Can you send some time available slots to volttron@pnnl.gov?