home home

downloads files

forum forum

docs docs

wiki wiki

faq faq

Cube & Cube 2 FORUM


understanding addmsg

by greeniekin on 12/23/2014 01:05, 1 messages, last message: 12/23/2014 07:55, 1176 views, last view: 04/17/2024 22:51

I been playing with modifying cube2.
I am able to send my custom message and receive it though it has variable size data. when i send a message it's encoded size is 41. when I receive on the other side I get the size is 41 though when i check p.length() it is only 2 when it should be at least 11(because 41char/int32). If i keep try and reading the server disconnects with an error"disconnecting(message error)..."
I can not understand why this is not working.


I have been using the following to send a custom message from client.

int transSize=((encodedSize+3)/sizeof(int));
addmsg(N_TEAMTALK, "riv",(int)encodedSize, transSize, &(data[0]));

data is an unsigned char array encodedSize is the data length.

on the server i use this

case N_TEAMTALK:
{

int sampleCount = getint(p);
conoutf(CON_GAMEINFO, "f2teamtalk %d %d!",p.length(),sampleCount);
int* samples = new int[(sampleCount+4)/sizeof(int)];
int i=0;

loopk(sampleCount/sizeof(int))
{
samples[i++]=getint(p);

}
delete[] samples;
break;
}

   Board Index   

#1: ..

by greeniekin on 12/23/2014 07:55

Never mind I managed to sort it out.

I managed to get voice chat working yay.

reply to this message

   Board Index   


Unvalidated accounts can only reply to the 'Permanent Threads' section!


content by Aardappel & eihrul © 2001-2024
website by SleepwalkR © 2001-2024
53763513 visitors requested 71532782 pages
page created in 0.017 seconds using 10 queries
hosted by Boost Digital