Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / MultiSync - Send data from Client to Client?

Author
Message
CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 28th Jul 2008 23:42
Hello, it's I again! x)

This time I have 3 'computers', one host and two clients. The problem is that the one client cannot send something to the other client. What is wrong?

Host:


Client:
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 29th Jul 2008 19:47
So all clients must send data to the host and then the host send all data back to every client? The clients cannot talk with each other?
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 29th Jul 2008 20:07
CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 29th Jul 2008 21:12
Okey... But it don't works! The first client get: '0; 1' and the second client get: '0; 1; 2' and so on. Why?

Host:


Client:
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 30th Jul 2008 07:09
Your code doesn't really make much sense and it assumes far too much. For instance:



This assumes right after it connects a message will be in the buffer, if this isn't the case then you get no data and you don't even check for this, you just get the message(which may not exist) and read data from it, which also may not exist, it's best to put a loop here until you get the message then process it.

The same thing happens in your client's main loop, you assume there to be a packet waiting for the client every loop, yet you never check if there is and you read 17 ints from this packet which may not exist. Also on both the client and server you're continually sending packets every loop which isn't a good idea, for LAN this might be OK as GDK limits you to VSync but over WAN this likely won't work. Not to mention I'm not sure what your code is supposed to be doing, where is 'spelare' even defined?

CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 30th Jul 2008 21:56
Spelare is the swedish word for gamer. I forgot to change it when I translate the code. The only thing I want is to list all players, but the client don't get all numbers.

But do you mean like this:

Host:


Client:


But something is still wrong, the clients get differet values...

Login to post a reply

Server time is: 2024-09-30 03:21:04
Your offset time is: 2024-09-30 03:21:04