Hi guys, this is what i have been doing for the past couple of hours.
(https://i.imgur.com/6xsxhBF.png)
Run your server and just double click announce.exe. It will announce to masterlist.
Just got an interest on how vcmp announce is working.
announce.cpp
[noae]#define WIN32_LEAN_AND_MEAN
#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <thread>
// Need to link with Ws2_32.lib, Mswsock.lib, and Advapi32.lib
#pragma comment (lib, "Ws2_32.lib")
#pragma comment (lib, "Mswsock.lib")
#pragma comment (lib, "AdvApi32.lib")
#define DEFAULT_BUFLEN 10240
int __cdecl main(int argc, char** argv)
{
char server_port[6] = "8192";
if (argc == 2)
{
if (strlen(argv[1]) < 4)ZeroMemory(server_port, 6);
memcpy(server_port, argv[1], strlen(argv[1]));
}
const char* PORT = "80";
const char* IP_ADDR = "master.vc-mp.org";
WSADATA wsaData;
SOCKET ConnectSocket = INVALID_SOCKET;
struct addrinfo* result = NULL,
* ptr = NULL,
hints;
char recvbuf[DEFAULT_BUFLEN];
int iResult;
int recvbuflen = DEFAULT_BUFLEN;
// Initialize Winsock
iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (iResult != 0) {
printf("WSAStartup failed with error: %d\n", iResult);
return 1;
}
ZeroMemory(&hints, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
//hints.ai_protocol = IPPROTO_UDP;
// Resolve the server address and port
iResult = getaddrinfo(IP_ADDR, PORT, &hints, &result);
if (iResult != 0) {
printf("getaddrinfo failed with error: %d\n", iResult);
WSACleanup();
return 1;
}
// Attempt to connect to an address until one succeeds
for (ptr = result; ptr != NULL; ptr = ptr->ai_next) {
// Create a SOCKET for connecting to server
ConnectSocket = socket(ptr->ai_family, ptr->ai_socktype,
ptr->ai_protocol);
if (ConnectSocket == INVALID_SOCKET) {
printf("socket failed with error: %ld\n", WSAGetLastError());
WSACleanup();
return 1;
}
// Connect to server.
iResult = connect(ConnectSocket, ptr->ai_addr, (int)ptr->ai_addrlen);
if (iResult == SOCKET_ERROR) {
closesocket(ConnectSocket);
ConnectSocket = INVALID_SOCKET;
continue;
}
break;
}
freeaddrinfo(result);
if (ConnectSocket == INVALID_SOCKET) {
printf("Unable to connect to server!\n");
WSACleanup();
return 1;
}
char buf[512];
sprintf(buf,"POST /announce.php HTTP/1.1\r\n"
"Host: master.vc-mp.org\r\n"
"Connection: close\r\n"
"User-Agent: VCMP/0.4\r\n"
"VCMP-Version: 0.4\r\n"//VCMP->GetServerVersion();
"Content-Type: application/x-www-form-urlencoded\r\n"
"Content-Length: %d\r\n"//strlen of "PORT:8192"
"\r\n"
"port=%s",5+strlen(server_port),server_port);
printf("%s\n", buf);
// Send an initial buffer
iResult = send(ConnectSocket, buf, strlen(buf), 0);
if (iResult == SOCKET_ERROR) {
printf("send failed with error: %d\n", WSAGetLastError());
closesocket(ConnectSocket);
WSACleanup();
return 1;
}
else printf("iResult is %d\n", iResult); int len = 5192;
char reply[4096];
iResult = 0;
iResult = recv(ConnectSocket, reply, len, 0);
if (iResult > 0)
{
printf("iResult is %d\n",iResult);
reply[iResult] = '\0';
printf("reply is %s\n", reply);
}
}
[/noae]
This is mainly made to call from other programs. You have to call regularly. samp calls their announce every 5 minutes. I think VCMP will retain server in masterlist for 15 minutes or so.
The default port is 8192. If there is a change in port, open Command Prompt, go to the directory where this exe lies and type
announce 8194
download (https://www.mediafire.com/file/ww8p58yy5ye553h/announce.exe/file)
GoodWork
Brother can update the link, I want to try this plugin, but my browser can't open Google Drive.
完毕 ( completed )
Okay, thank you.