SS Master Server Connection [message #185298] |
Tue, 10 January 2006 20:28 |
|
theplague
Messages: 261 Registered: May 2004
Karma: 0
|
Recruit |
|
|
Am i doing something wrong? :S i'm following the instructions from SSC.txt formt eh brenbot site of mac...
it just dosn't show up on the server listings :S
here is a few parts i use:
while (RgConnected == false) {
if (connect(RgSocket, (SOCKADDR *)(&RgAddr), sizeof(RgAddr)) == 0) {
send_rgsock_raw("123456789\n");
RgConnected = true;
printf("Renguard Master Server Connection Established to Master Server %d! On %s:6382\n", serveri, server);
char tmp[1024], tmp2[1024];
sprintf(tmp, "300 XpzElite/%f", hard_ver);
send_rg(tmp);
getProfileString("Settings","bGameTitle","Xphaze",tmp2,1024,"data\\svrcfg_cnc.ini");
sprintf(tmp, "310 %s", tmp2);
send_rg(tmp);
send_rg("340");
sprintf(tmp, "320 %s", CurrMap);
send_rg(tmp);
RgRotation();
}
}
void send_rg(char *text) {
// using this you can like send things normaly (eg: 830 C&C_Glacier_Flying.mix << crap map)
char text2[2048];
std::string base64 = base64_encode(reinterpret_cast<const unsigned char*>(text), strlen(text));
sprintf(text2, "%s\n", base64.c_str());
send(RgSocket, text2, strlen(text2), 0);
}
void send_rgsock_raw(const char *text) {
send(RgSocket, text, strlen(text), 0);
printf("%s sent", text);
}
std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) {
std::string ret;
int i = 0;
int j = 0;
unsigned char char_array_3[3];
unsigned char char_array_4[4];
while (in_len--) {
char_array_3[i++] = *(bytes_to_encode++);
if (i == 3) {
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
char_array_4[3] = char_array_3[2] & 0x3f;
for(i = 0; (i <4) ; i++)
ret += base64_chars[char_array_4[i]];
i = 0;
}
}
if (i)
{
for(j = i; j < 3; j++)
char_array_3[j] = '\0';
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
char_array_4[3] = char_array_3[2] & 0x3f;
for (j = 0; (j < i + 1); j++)
ret += base64_chars[char_array_4[j]];
while((i++ < 3))
ret += '=';
}
return ret;
}
static const std::string base64_chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
[Updated on: Tue, 10 January 2006 20:29] Report message to a moderator
|
|
|
|
|
Re: SS Master Server Connection [message #186486 is a reply to message #185298] |
Sat, 21 January 2006 05:42 |
=HT=T-Bird
Messages: 712 Registered: June 2005
Karma: 0
|
Colonel |
|
|
Could you PM me a link to that file you're talking about?
HTT-Bird (IRC)
HTTBird (WOL)
Proud HazTeam Lieutenant.
BlackIntel Coder & Moderator.
If you have trouble running BIATCH on your FDS, have some questions about a BIATCH message or log entry, or think that BIATCH spit out a false positive, PLEASE contact the BlackIntel coding team and avoid wasting the time of others.
|
|
|