Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Archived Forums » RenGuard Servers » SS Master Server Connection
SS Master Server Connection [message #185298] Tue, 10 January 2006 20:28 Go to previous message
theplague is currently offline  theplague
Messages: 261
Registered: May 2004
Karma:
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+/";


http://users.tpg.com.au/ling44/av_firefox.gifhttp://users.tpg.com.au/ling44/av_rg.gif

[Updated on: Tue, 10 January 2006 20:29]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Need to bring this to BHS's attention
Next Topic: Server side RenGuard don't auth me
Goto Forum:
  


Current Time: Tue Dec 03 08:49:34 MST 2024

Total time taken to generate the page: 0.00797 seconds