From kde-games-devel Thu Apr 19 12:06:36 2001 From: Burkhard Lehner Date: Thu, 19 Apr 2001 12:06:36 +0000 To: kde-games-devel Subject: Re: [Kde-games-devel] Network operations class? X-MARC-Message: https://marc.info/?l=kde-games-devel&m=98768199600851 > You just have to take care of two things: > 1. Andi already mentioned it: The message has of course a > header which will be received on the other side. If you really evaluate > raw data you have to analyse this header by your self (or ignore it). > You have to look at kgamemessage.h to or the readme file to see > its structure (it is a few integer values) I'm working on a replacement for the underlying messageing system, so don't rely on the header format too much, it is likely to change in the near future. > 2. You of course cannot stream QStrings etc into the messages as > your programm does not understand it. You can use stream.writeRawBytes > though to get raw data into the stream (see QT doc for details). I have > not tested it but I could imagine that you will get the raw data out on > the other side, so e.g. > char *s="Hello"; stream.writeRawData(s,strlenm(s)); or so... If you only want to store simple C type string (character array, ending in a \0), you can do it a lot easier: QCString msg = ".gl"; game_sock->sendMessage (msg); Reason for this: QCString is a subclass of QByteArray, especially used for strings in old C fashion. This way you don't need a QDataStream at all. But if you want to contact a server that is not a KGameCommunicationServer or a KMessageServer (its future replacement), you should indeed use QSocket or KSocket directly. Bye, Burkhard ---------------------------------------------------------------- Burkhard Lehner Burkhard.Lehner@gmx.de Pfaffenbergstraße 101 Tel: (0631) 1 03 63 67663 Kaiserslautern Fax: (0631) 3 10 52 15 http://www.burkhardlehner.de/ _______________________________________________ Kde-games-devel mailing list Kde-games-devel@master.kde.org http://master.kde.org/mailman/listinfo/kde-games-devel