GoD2.0 wrote: Crock wrote: GoD2.0, whoops, i forgot to remove this code... btw this redirection method are not usable for steam clients, so subserver becomes useless I worked around a little bit with the code for redirect and found a method that works for both steam and non-steam clients. I post the code below for subserver.cpp: - void CSubServer::ParseConnect(char* buf, int len, unsigned int ip, unsigned int port) {
- char* cbuf = buf + 4;
- char SBuf[1500];
- in_addr ina;
- int res;
- if (len < 11) return;
- if (strncmp(cbuf, "connect", 7)) return;
- cbuf = SBuf;
- SIN_SET_ADDR(&ina, ip);
- res = sprintf(cbuf, "%c%c%c%c%c %d \"%s:%d\" %d", 0xFF, 0xFF, 0xFF, 0xFF, 'B', 1, inet_ntoa(ina), port, 0);
- cbuf += res;
-
- res = cbuf - SBuf;
- SendData(SBuf, res, ip, port);
-
- cbuf = SBuf;
- res = sprintf(cbuf, "%c%c%c%c%c%c%c%c", 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0);
- cbuf += res;
-
- res = sprintf(cbuf, "%c%s", 0x9, "echo \"* Redirecting...\"; ");
- cbuf += res;
-
- res = sprintf(cbuf, "%s\n", ExecCmd);
- cbuf += res + 1;
-
- res = cbuf - SBuf;
- while (res % 4) {
- SBuf[res++] = 1;
- }
-
- Munge2((int*)(SBuf+8), res-8, 0);
- SendData(SBuf, res, ip, port);
- }
If i can be of help with other things please do not hesitate to PM me  Thank you! I just tried this and redirection works for Steam as well, good job!
|