PDA

View Full Version : Using QtNetwork to allow my own chess program can make plays through LAN network



Hogwarts
11th June 2013, 21:25
Hi
I'm developving a chess program using Qt, right now it's fully functional, two players can play in the same PC, but I want to allow 2 players to play in local network, and n observers using my program can watch it and all of then (the two players and others) can chat. I've been studing network examples in Qt Assistant, and I think the example that I can use is Network Chat (with some changes of course), but I'm new in Qt Network module and I need some help to carry out my desire. (this example is not fully documented)

I only need to send two QPoints (x,y coordinates), oldPos and newPos for each move between the two players PCs and all the chat conversation, where every one can see all comments.

thanks in advanced

pd: sorry my English

wysota
11th June 2013, 23:15
But what exactly is the problem you are having?

Hogwarts
13th June 2013, 17:51
First at all thanks wysota for your answer

Well the problem right now is network-chat example are not fully documented and like I said I'm new using QtNetwork module and I'm new using networking operations.

I need to make some changes to this example:

all connections to the server must know and use the same port, because if there are more than one server game running, I' need to allow choose one of them.

connected people can choose who they want to talk, or send all people connected a comment

Only that I need is some help to understand how network-chat example's main classes works

Thanks in advanced

pd: sorry my English

wysota
13th June 2013, 20:43
I think you should start by designing a protocol you wish to implement. I'm sure there are lots of materials on that topic in the Internet. Only when you have the design ready start thinking how to implement it in Qt. Doing it the other way is not a good approach.