[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-games-devel
Subject:    Re: [Kde-games-devel] Network operations class?
From:       Burkhard Lehner <Burkhard.Lehner () gmx ! de>
Date:       2001-04-19 12:06:36
[Download RAW message or body]

> 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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic