If I wrote two messages on the Client and then look at the Host, it seems that I get the first message two times! Why?
Host:
#include <DarkGDK.h>
#include "multisync.h"
int counter = 0;
int strfrom = 0;
char text[200];
void DarkGDK ( void )
{
dbSyncOn();
dbRandomize(dbTimer());
if (NetHost(16))
{
while (LoopGDK())
{
dbCLS();
if (NetPlayerJoined() != 0)
{
counter++;
}
if (counter > 0)
{
if (NetGetMessage())
{
NetGetString(text, 200);
strfrom = NetMessageFrom();
dbText(0, 0, text);
dbText(0, 10, dbStr(strfrom));
dbText(0, 20, "Press a key for next message.");
dbWaitKey();
}
}
dbSync();
}
}
}
Client:
#include <DarkGDK.h>
#include "multisync.h"
char* text;
void DarkGDK ( void )
{
dbSyncOn();
if (NetConnect("127.0.0.1"))
{
while(LoopGDK())
{
dbCLS();
text = dbEntry();
dbText(0, 0, "Write something:");
dbText(0, 16, text);
if (dbReturnKey())
{
if (dbLen(text) > 0)
{
NetPutString(text);
NetSend(0);
text = "";
dbClearEntryBuffer();
}
}
dbSync();
}
}
}