Re: [Flightgear-devel] internal telnet weirdness
On Friday, August 09, 2013 15:47:57 Curtis Olson wrote: > For a work project I ended up modifying a qt program (C++) to talk to the > FlightGear interface. I pulled in the plib socket routines and used those, > mostly because I was unaware of/unfamiliar with the qt socket routines. My > approach maybe wasn't quite as clean as doing everything in already > available qt functions, but I haven't had any problems with the > communication. > > Regards, > > Curt. > Hi Curtis, I might consider that, but for the moment I'd like to keep my project clean of other dependencies besides Qt. If there's no other way, I'll consider using another socket library, of course. Thanks for the suggestion. Btw, since we're on this subject, my patch for src/Network/props.cxx never got merged, so there's no useful way to execute a Nasal script stored in a property, with the command "nasal /sim/radio/waypoint/nasal" for example. I found last year the command in the docs, but it was probably never used before? Let me know if you'd like to get the code for that, I'm using it in my projects and it's a one or two line change. Or you could run a diff between my clone on branch radio_next and your master tree. Cheers, Adrian -- Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk ___ Flightgear-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] internal telnet weirdness
For a work project I ended up modifying a qt program (C++) to talk to the
FlightGear interface. I pulled in the plib socket routines and used those,
mostly because I was unaware of/unfamiliar with the qt socket routines. My
approach maybe wasn't quite as clean as doing everything in already
available qt functions, but I haven't had any problems with the
communication.
Regards,
Curt.
On Fri, Aug 9, 2013 at 7:34 AM, Adrian Musceac wrote:
> On Friday, August 09, 2013 13:21:45 James Turner wrote:
> > Qt sockets are very thin wrappers around BSD / Windows sockets. More
> likely
> > to be a character set / encoding issue? Remember you need to be explicit
> > about encoding when going from 8-bit representation to a QString.
> >
> > That said I've no experience with the FG telnet code. If you want to post
> > your client code I'm happy to quickly look at it.
> >
> > James.
>
> Hi James,
> You're quite correct, I also think it's an encoding issue. Qt 4.8 had a
> toAscii() translation, while Qt 5.1 has got rid of that and supposedly it's
> functionality is enclosed in toLatin1().
>
> Basically I've reached a state where out of ideas I'm just reading the
> response one char after another, then appending it to a QString.
>
> QString line;
> while(!_socket->canReadLine()){}
> ...snip...
> while ((!endOfLine)) {
> char c;
> int bytesRead = _socket->read(&c, sizeof(c));
>
> ...snip...
> line.append( c );
>
> Then after testing for a '\r' char which signals the end of line, I'm
> returning the QString to it's user.
> I have to use a blocking approach due to the already existing structure,
> but
> it's not a problem, since this is on it's own thread. I think the encoding
> is
> the problem here, but I don't have a clue why the Python wrapper does it
> right
> while Qt doesn't.
>
> Cheers,
> Adrian
>
>
>
> --
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> ___
> Flightgear-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
>
--
Curtis Olson:
http://www.atiak.com - http://aem.umn.edu/~uav/
http://www.flightgear.org - http://gallinazo.flightgear.org
--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk___
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] internal telnet weirdness
On Friday, August 09, 2013 13:21:45 James Turner wrote:
> Qt sockets are very thin wrappers around BSD / Windows sockets. More likely
> to be a character set / encoding issue? Remember you need to be explicit
> about encoding when going from 8-bit representation to a QString.
>
> That said I've no experience with the FG telnet code. If you want to post
> your client code I'm happy to quickly look at it.
>
> James.
Hi James,
You're quite correct, I also think it's an encoding issue. Qt 4.8 had a
toAscii() translation, while Qt 5.1 has got rid of that and supposedly it's
functionality is enclosed in toLatin1().
Basically I've reached a state where out of ideas I'm just reading the
response one char after another, then appending it to a QString.
QString line;
while(!_socket->canReadLine()){}
...snip...
while ((!endOfLine)) {
char c;
int bytesRead = _socket->read(&c, sizeof(c));
...snip...
line.append( c );
Then after testing for a '\r' char which signals the end of line, I'm
returning the QString to it's user.
I have to use a blocking approach due to the already existing structure, but
it's not a problem, since this is on it's own thread. I think the encoding is
the problem here, but I don't have a clue why the Python wrapper does it right
while Qt doesn't.
Cheers,
Adrian
--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
___
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] internal telnet weirdness
On 9 Aug 2013, at 10:59, Adrian Musceac wrote: > I'm writing an application which uses a socket to connect to Flightgear's > telnet interface, and I have encountered the following issue: > Writing to Flightgear is fine, but while reading the socket, some properties > have weird values, and some characters are getting replaced (L is sometimes > replaced by 0 etc.). > I am using "data" mode to read from the socket. I have noticed that the > Python > Flightgear telnet interface uses "prompt" when reading. > I'm wondering if someone else has encountered this, or is this some Qt socket > issue I have to sort out on my own. Qt sockets are very thin wrappers around BSD / Windows sockets. More likely to be a character set / encoding issue? Remember you need to be explicit about encoding when going from 8-bit representation to a QString. That said I've no experience with the FG telnet code. If you want to post your client code I'm happy to quickly look at it. James.-- Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk___ Flightgear-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/flightgear-devel

