[Qt-interest] QTcpSocket receives a string
Alexandre Beraud
aberaud at infflux.com
Mon Apr 6 16:27:33 CEST 2009
Hi,
Read this:
http://doc.trolltech.com/4.4/qiodevice.html#readLine-2
(QTcpSocket derives from QIODevice)
Then convert your QByteArray into a QString and use split() on it.
Regards,
Alex
Stefanos Antaris a écrit :
> Hello.Can anyone tell me how could i receive a string using a tcp
> socket?The server is not a qt application.It just send me a string like
> this."0039,0023,0049,0594".And how could i break this one into parts
> like this.
> QString a1="0039"
> QString a2="0023"
> QString a3="0049"
>
> I know how to connect using this code
>
>
> QTcpSocket* tcpSocket;
> tcpSocket=new QTcpSocket;
> tcpSocket->connectToHost("192.168.1.1",6779);
> [\code]
> I just don't know which function should i use in order to receive a
> stream.Moreover i tried to used the C++ function atoi and it just don't
> compile it.
> Thanks in advance.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
--
BERAUD Alexandre
Ingénieur Développement
Infflux - Informatique & Flux
Tel: 01 49 57 92 00 - Fax : 01 49 57 92 01
Mail: aberaud at infflux.com
Visitez notre site : www.infflux.com
More information about the Qt-interest-old
mailing list