Your code is working fine on my end.
What sumo version did you try this with?
Are your error symptoms still the same as before (***starting server on
port 8813***  and nothing else happening)?
If you abort client2, what does the strack-trace say?

Am Fr., 21. Dez. 2018 um 10:28 Uhr schrieb <[email protected]>:

> i did, it didn't work out, these are my scripts:
>
> client1:
>
>
> import traci
>
> sumoBinary = "D:\\Programme\\Eclipse\\Sumo\\bin\\sumo-gui.exe"
> #sumoCmd = [sumoBinary, "-c", "D:\\Repos\\abc\\xyz\\SUMO\\config.sumo.cfg", 
> "--num-clients", "2"]
>
> traci.start(cmd=[sumoBinary, "-c", 
> "D:\\Repos\\abc\\xyz\\SUMO\\config.sumo.cfg"], port=8813, label="sim1")
>
> conn1 = traci.getConnection("sim1")
>
> conn1.setOrder(1)
>
> step = 0
>
> while step < 1000:
>     conn1.simulationStep()
>     print("I'm client1")
>     step += 1
>
> conn1.close()
>
>
> client2:
>
>
> import traci
>
> traci.init(port=8813, label="sim2")
>
> conn2 = traci.getConnection("sim2")
>
> conn2.setOrder(2)
>
> step = 0
>
> while step < 1000:
>     conn2.simulationStep()
>     print("I'm client2")
>     step += 1
>
> conn2.close()
>
>
> my enviroment variables are set up fine.
>
> *Gesendet:* Freitag, 21. Dezember 2018 um 09:58 Uhr
> *Von:* "Jakob Erdmann" <[email protected]>
> *An:* "Sumo project User discussions" <[email protected]>
> *Betreff:* Re: [sumo-user] two clients, one SUMO connection (python -
> TraCI)
> Please try the following minimal version. It only assumes that SUMO_HOME
> has been defined and 'sumo-gui' is on the path.
>
>
> Am Fr., 21. Dez. 2018 um 09:06 Uhr schrieb <[email protected]>:
>
>> man, still not working. I did it as you said, nothing, still the same
>> loading thing at starting server. I also did it in like two clean scripts.
>>
>> maybe in my cfg?
>>
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <configuration>
>>   <traci_server>
>>     <remote-port value="8813" />
>>     <num-clients value="2" />
>>   </traci_server>
>>   <input>
>>     <net-file value="XYZ.net.xml"/>
>>     <additional-files value="XYZ_new_vehicles.xml, XYZ_rou.add.xml"/>
>>     <gui-settings-file value="settings.xml"/>
>>    <start value="true"/>
>>   </input>
>>   <time>
>>    <begin>21600</begin>
>>    <end>28800</end>
>>    <step-length>0.01</step-length>
>>   </time>
>>   <processing>
>>    <step-method.ballistic>true</step-method.ballistic>
>>   </processing>
>>
>>   <report>
>>    <no-warnings>true</no-warnings>
>>   </report>
>>
>> </configuration>
>>
>>
>> i don't know what to do more.
>>
>> Thanks and greetings
>>
>>
>>
>>
>> *Gesendet:* Donnerstag, 20. Dezember 2018 um 16:18 Uhr
>> *Von:* "Benedikt Schott" <[email protected]>
>> *An:* "'Sumo project User discussions'" <[email protected]>
>> *Betreff:* Re: [sumo-user] two clients, one SUMO connection (python -
>> TraCI)
>>
>> As far as I know traci.simulationStep calls simulationStep on your first
>> connection created via traci.start, you need to also call
>> conn2.simulationStep. Instead of calling traci.simulationStep you can get
>> the its connection of the first client via traci.getConnection, see e.g.
>>
>>
>>
>> traci.start(sumoCmd, port=8813, label="sim1")
>>
>> conn1 = traci.getConnection("sim1")
>>
>> conn1.setOrder(1)
>>
>>
>>
>> The following snippets should work:
>>
>>
>>
>> ---------------
>>
>> Client 1:
>>
>> ---------------
>>
>>
>>
>> sumoBinary =
>> "C:\\Projekte\\Sumo_Eclipse\\Releases\\sumo-win64-1.1.0\\sumo-1.1.0\\bin\\sumo-gui"
>>
>> sumoCmd = [sumoBinary, "-c", cfg]
>>
>>
>>
>> traci.start(sumoCmd, port=8813, label="sim1")
>>
>> conn1 = traci.getConnection("sim1")
>>
>> conn1.setOrder(1)
>>
>>
>>
>> step = 0
>>
>> while step < 1000:
>>
>>     conn1.simulationStep()
>>
>>     step += 1
>>
>>
>>
>> conn1.close()
>>
>>
>>
>> ---------------
>>
>> Client 2:
>>
>> ---------------
>>
>> traci.init(port=8813, label="sim2")
>>
>> conn2 = traci.getConnection("sim2")
>>
>> conn2.setOrder(2)
>>
>>
>>
>> step = 0
>>
>> while step < 1000:
>>
>>     conn2.simulationStep()
>>
>>     step += 1
>>
>>
>>
>> conn2.close()
>>
>>
>>
>>
>>
>> *Von:* [email protected] [mailto:
>> [email protected]] *Im Auftrag von *[email protected]
>> *Gesendet:* Donnerstag, 20. Dezember 2018 15:37
>> *An:* [email protected]
>> *Betreff:* Re: [sumo-user] two clients, one SUMO connection (python -
>> TraCI)
>>
>>
>>
>> okey, still not working, here are my to client-snippets:
>>
>>
>>
>> client1:
>>
>>
>>
>> # default port
>>
>> PORT = 8813
>>
>>
>>
>> client2 = Com()
>>
>>
>>
>> class runner:
>>
>>
>>
>>     port = getFreeSocketPort()
>>
>>     # if getFreeSocketPort returns None, initialize with default value
>>
>>     if not port:
>>
>>         port = PORT
>>
>>     sumoBinary = "sumo-gui.exe"
>>
>>
>>
>>     # starting sumo
>>
>>     traci.start(cmd=[sumoBinary, "-c", 
>> "pathToConfig\\SUMO\\config.sumo.cfg", "--num-clients", "2"], port=8813)
>>
>>     # establishing client order
>>
>>     traci.setOrder(1)
>>
>>
>>
>> client2:
>>
>>
>>
>> # default port
>>
>> PORT = 8813
>>
>>
>>
>> class Com:
>>
>>
>>
>>     def traci_client2(self):
>>
>>
>>
>>         port = getFreeSocketPort()
>>
>>         # if getFreeSocketPort returns None, initialize with default value
>>
>>         if not port:
>>
>>             port = PORT
>>
>>
>>
>>         traci.init(port=8813, label="sim2")
>>
>>         conn2 = traci.getConnection("sim2")
>>
>>         conn2.setOrder(2)
>>
>>
>>
>>         while traci.simulation.getMinExpectedNumber() > 0:
>>
>>
>>
>>             traci.simulationStep()
>>
>> so, as far as i understand, it stucks while it loads because sumo is
>> waiting for client2?
>>
>>
>>
>> Maybe you can see anything in my code.
>>
>>
>>
>> Thanks and greetings
>>
>>
>>
>> *Gesendet:* Donnerstag, 20. Dezember 2018 um 15:13 Uhr
>> *Von:* "Benedikt Schott" <[email protected]>
>> *An:* "'Sumo project User discussions'" <[email protected]>
>> *Betreff:* Re: [sumo-user] two clients, one SUMO connection (python -
>> TraCI)
>>
>> When the sumo gui has been started, it is waiting for the second client
>> to connect. Note that you have to call setOrder for all clients and to call
>> simulationStep for each client to proceed with the simulation
>>
>>
>>
>> e.g. for the second client:
>>
>>
>>
>> traci.init(port=xxxx, label="sim2")
>>
>> conn2 = traci.getConnection("sim2")
>>
>> conn2.setOrder(2)
>>
>>
>>
>> step = 0
>>
>> while step < 1000:
>>
>>     conn2.simulationStep()
>>
>>     step += 1
>>
>>
>>
>> conn2.close()
>>
>>
>>
>> *Von:* [email protected] [mailto:
>> [email protected]] *Im Auftrag von *[email protected]
>> *Gesendet:* Donnerstag, 20. Dezember 2018 14:22
>> *An:* [email protected]
>> *Betreff:* Re: [sumo-user] two clients, one SUMO connection (python -
>> TraCI)
>>
>>
>>
>> thanks for the information Jakob!
>>
>>
>>
>> So I implemented it, but when I start my runner script, it opens my
>> sumo-gui as usually, but it's only displaying "starting server on port
>> xxxx" and nothing happens, just loading. When I'm changing the
>> --num-clients in the traci.start to "1" it starts normally.
>>
>>
>>
>> Any ideas?
>>
>>
>>
>> Greetings
>>
>>
>>
>> *Gesendet:* Donnerstag, 20. Dezember 2018 um 11:31 Uhr
>> *Von:* "Jakob Erdmann" <[email protected]>
>> *An:* "Sumo project User discussions" <[email protected]>
>> *Betreff:* Re: [sumo-user] two clients, one SUMO connection (python -
>> TraCI)
>>
>> see
>> http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python#Controlling_the_same_simulation_from_multiple_clients
>>
>>
>>
>> Am Do., 20. Dez. 2018 um 10:52 Uhr schrieb <[email protected]>:
>>
>> Hello everyone,
>>
>>
>>
>> so i'm new to SUMO and want to connect two different clients (both python
>> scripts, Interface: TraCI) to the same SUMO connection.
>>
>> How can I do that exactly? I read about the simulationSteps from the post
>> yesterday, but I can't manage to implement it.
>>
>>
>>
>> Thanks a lot.
>>
>>
>>
>> Greetings!
>>
>> _______________________________________________
>> sumo-user mailing list
>> [email protected]
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://www.eclipse.org/mailman/listinfo/sumo-user
>>
>> _______________________________________________ sumo-user mailing list
>> [email protected] To change your delivery options, retrieve your
>> password, or unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/sumo-user
>>
>> _______________________________________________ sumo-user mailing list
>> [email protected] To change your delivery options, retrieve your
>> password, or unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/sumo-user
>> _______________________________________________ sumo-user mailing list
>> [email protected] To change your delivery options, retrieve your
>> password, or unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/sumo-user
>> _______________________________________________
>> sumo-user mailing list
>> [email protected]
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://www.eclipse.org/mailman/listinfo/sumo-user
>
> _______________________________________________ sumo-user mailing list
> [email protected] To change your delivery options, retrieve your
> password, or unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-user
> _______________________________________________
> sumo-user mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-user
>
_______________________________________________
sumo-user mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to