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 <kanto...@gmail.com> 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
> Flightgear-devel@lists.sourceforge.net
> 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
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to