Discussion:
[sumo-user] TRaCI connection refused error
zhang
2011-12-12 00:31:23 UTC
Permalink
Dear SUMO users ,

I have been trying to implement Traci client in C for my bachelor degree
project .

I am using sumo 0.12.3, I just wanted to see the working of Traci client
so i used testclient which needs a ".def" file which is not provided in
the package. (where do i find it ?)

I implemented a basic structure in C with storage implemented using
struct and linking. I start the SUMO with

sumo -n netfile.xml -r routefile.xml -b 4000 --remote-port 8888

this terminal doesnt pop up any message (but keeps listening)

when i start my client which can send CMD_SIMSTEP and receive response,i get
"connection refused" if i keep on connecting then i get

sumo -n netfile.xml -r routefile.xml --remote-port 8888
Step #0.00Error: tcpip::Socket::receive() @ recv: Success
Quitting (on error).

I am finding no way out .. any suggestion will be helpfull

BR
zhang
Björn Hendriks
2011-12-12 19:00:57 UTC
Permalink
Hi Zhang,
Post by zhang
I implemented a basic structure in C with storage implemented using
struct and linking. I start the SUMO with
sumo -n netfile.xml -r routefile.xml -b 4000 --remote-port 8888
this terminal doesnt pop up any message (but keeps listening)
when i start my client which can send CMD_SIMSTEP and receive response,i
get "connection refused" if i keep on connecting then i get
What exactly do you send to SUMO? Have you tried to compare the output of a
network sniffer (for example Wireshark) with the data sent by your program?
Post by zhang
sumo -n netfile.xml -r routefile.xml --remote-port 8888
Quitting (on error).
"Success" is probably an error message from your operating system after a call
to the OS function recv() returned a negative value to indicate an error:

#ifdef WIN32
int e = WSAGetLastError();
std::string msg = GetWinsockErrorString( e );
#else
std::string msg = strerror( errno );
#endif

Of course, it's strange to receive "success" as error message; maybe something
else influences errno or WSAGetLastError(). Are you sure no other application
uses port 8888? Maybe the docs of your OS can put some light on this.

Regards
Björn
zhang wi
2011-12-12 20:01:09 UTC
Permalink
Dear Bjorn,

I didn't use wineshark.. will give it a go.


Well regarding my work platform

--> I use ubuntu VM on top of Mac .

--> the structure of the message is exactly the same as

as the c++ implementation supplied with source package instead of

vectors i have used list . Rest all remains the same (compatible

with c).

1st i tried to connect, when i do that the server should say that

it has accepted connection (as in the server code sumo/src/traciclient)

but i don't get that message, server is quite, then i thought i have

send some command . So i sent CMD_SIMSTEP, but still it doesn't respond


Is there any working client ? where can i find it .. I just want to understand

how it works . The traci test client(in the package) needs a def file
which doesn't exist

where can i find it ?



Hi Zhang,
Post by zhang
I implemented a basic structure in C with storage implemented using
struct and linking. I start the SUMO with
sumo -n netfile.xml -r routefile.xml -b 4000 --remote-port 8888
this terminal doesnt pop up any message (but keeps listening)
when i start my client which can send CMD_SIMSTEP and receive response,i
get "connection refused" if i keep on connecting then i get
What exactly do you send to SUMO? Have you tried to compare the output of a
network sniffer (for example Wireshark) with the data sent by your program?
Post by zhang
sumo -n netfile.xml -r routefile.xml --remote-port 8888
Quitting (on error).
"Success" is probably an error message from your operating system after a call
to the OS function recv() returned a negative value to indicate an error:

#ifdef WIN32
int e = WSAGetLastError();
std::string msg = GetWinsockErrorString( e );
#else
std::string msg = strerror( errno );
#endif

Of course, it's strange to receive "success" as error message; maybe something
else influences errno or WSAGetLastError(). Are you sure no other application
uses port 8888? Maybe the docs of your OS can put some light on this.

Regards
Björn
Daniel Krajzewicz
2011-12-13 09:15:16 UTC
Permalink
Dear Zhang,

you may consider the Python examples at:
-
http://sumo.sourceforge.net/doc/current/docs/Tutorials/TraCI4Traffic_Lights.html
- http://sumo.sourceforge.net/doc/current/docs/Tutorials/CityMobil.html

For the .cpp-client, you should take a look at the tests. In
<SUMO>/tests/traci/* you will find several tests which also include the
def-file you mentioned. The definition file is always named
"testclient.prog".

sincerely,
Daniel
Post by zhang wi
Dear Bjorn,
I didn't use wineshark.. will give it a go.
Well regarding my work platform
--> I use ubuntu VM on top of Mac .
--> the structure of the message is exactly the same as
as the c++ implementation supplied with source package instead of
vectors i have used list . Rest all remains the same (compatible
with c).
1st i tried to connect, when i do that the server should say that
it has accepted connection (as in the server code sumo/src/traciclient)
but i don't get that message, server is quite, then i thought i have
send some command . So i sent CMD_SIMSTEP, but still it doesn't respond
Is there any working client ? where can i find it .. I just want to understand
how it works . The traci test client(in the package) needs a def file
which doesn't exist
where can i find it ?
Hi Zhang,
Post by zhang
I implemented a basic structure in C with storage implemented using
struct and linking. I start the SUMO with
sumo -n netfile.xml -r routefile.xml -b 4000 --remote-port 8888
this terminal doesnt pop up any message (but keeps listening)
when i start my client which can send CMD_SIMSTEP and receive response,i
get "connection refused" if i keep on connecting then i get
What exactly do you send to SUMO? Have you tried to compare the output of a
network sniffer (for example Wireshark) with the data sent by your program?
Post by zhang
sumo -n netfile.xml -r routefile.xml --remote-port 8888
Quitting (on error).
"Success" is probably an error message from your operating system after a call
#ifdef WIN32
int e = WSAGetLastError();
std::string msg = GetWinsockErrorString( e );
#else
std::string msg = strerror( errno );
#endif
Of course, it's strange to receive "success" as error message; maybe something
else influences errno or WSAGetLastError(). Are you sure no other application
uses port 8888? Maybe the docs of your OS can put some light on this.
Regards
Björn
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
sumo-user mailing list
https://lists.sourceforge.net/lists/listinfo/sumo-user
Björn Hendriks
2011-12-13 11:56:49 UTC
Permalink
Hi Zhang,
Post by zhang wi
Well regarding my work platform
--> I use ubuntu VM on top of Mac .
I use a native Ubuntu, so that should work in general.
Post by zhang wi
--> the structure of the message is exactly the same as
as the c++ implementation supplied with source package instead of
vectors i have used list . Rest all remains the same (compatible
with c).
Do you mean you've taken the existing code and replaced std::vector by
std::list? That won't work. The C++ ISO-standard requires std::vector to
behave like a C array (including pointer arithmetic) as long as you don't
change its capacity (IIRC resizing within capacity won't hurt). But, std::list
has very different requirements which are usually fulfilled by a doubly linked
list. Hence, pointer arithmetic on a std::list is undefined behavior.
Post by zhang wi
1st i tried to connect, when i do that the server should say that
it has accepted connection (as in the server code sumo/src/traciclient)
but i don't get that message, server is quite, then i thought i have
I think the server follows the old unix paradigm that no message means no
error. At least, I got no announcement of an established connection.
Post by zhang wi
send some command . So i sent CMD_SIMSTEP, but still it doesn't respond
If not configured to be quiet SUMO usually prints the reached time step to
stdout. I just tried to send a manually assembled CMD_SIMSTEP with netcat and
that worked.
Post by zhang wi
Is there any working client ? where can i find it .. I just want to understand
A C++ client is included in Shawn (shawn.sourceforge.net).

Regards
Björn

Loading...