Vice City: Multiplayer

VC:MP Discussion => Support => Topic started by: EK.IceFlake on Feb 18, 2015, 01:34 PM

Title: Packet information for masterlist?
Post by: EK.IceFlake on Feb 18, 2015, 01:34 PM
Hi guys! I wanted to make my masterlist for vcmp, what are the packet information that I have to send/recieve? I will of course check out the announce plugin source, but that probably wont tell me much. Thanks for help.
Title: Re: Packet information for masterlist?
Post by: Thijn on Feb 18, 2015, 05:43 PM
Masterlist as in, the url you can put in your browser?
Title: Re: Packet information for masterlist?
Post by: ysc3839 on Feb 19, 2015, 06:56 AM
Quote from: NE.CrystalBlue on Feb 18, 2015, 01:34 PMHi guys! I wanted to make my masterlist for vcmp, what are the packet information that I have to send/recieve? I will of course check out the announce plugin source, but that probably wont tell me much. Thanks for help.
Capture the packet by yourself and analysis it!
Title: Re: Packet information for masterlist?
Post by: ysc3839 on Feb 19, 2015, 07:14 AM
Here is the request and response.
GET //servers/ HTTP/1.0
Host: master.vc-mp.org
User-Agent: HTTP Fetcher/HTTP/1.0
Connection: Close

{"success":true,"servers":[{"ip":"95.85.12.227","port":5192,"is_official":false},{"ip":"198.52.128.114","port":8192,"is_official":false},{"ip":"37.187.201.205","port":5194,"is_official":false},{"ip":"31.220.48.196","port":5176,"is_official":false},{"ip":"5.135.145.71","port":5200,"is_official":false},{"ip":"192.99.199.92","port":5724,"is_official":false},{"ip":"192.254.78.2","port":5190,"is_official":false},{"ip":"110.182.6.4","port":8192,"is_official":false},{"ip":"120.141.67.167","port":8192,"is_official":false},{"ip":"60.172.228.36","port":55555,"is_official":false}]}
Title: Re: Packet information for masterlist?
Post by: EK.IceFlake on Feb 19, 2015, 11:14 AM
@ysc3839
1. Analyzing is too hard
2. is {"success":true,"servers":[{"ip":"95.85.12.227","port":5192,"is_official":false},{"ip":"198.52.128.114","port":8192,"is_official":false},{"ip":"37.187.201.205","port":5194,"is_official":false},{"ip":"31.220.48.196","port":5176,"is_official":false},{"ip":"5.135.145.71","port":5200,"is_official":false},{"ip":"192.99.199.92","port":5724,"is_official":false},{"ip":"192.254.78.2","port":5190,"is_official":false},{"ip":"110.182.6.4","port":8192,"is_official":false},{"ip":"120.141.67.167","port":8192,"is_official":false},{"ip":"60.172.228.36","port":55555,"is_official":false}]} supposed to be sent as a string or something else? I am using VB.NET.
Thanks
Title: Re: Packet information for masterlist?
Post by: . on Feb 19, 2015, 11:17 AM
Quote from: NE.CrystalBlue on Feb 19, 2015, 11:14 AMsupposed to be sent as a string or something else? I am using VB.NET.

That's JSON. And yes, that's supposed to be a string. I might be wrong tho, so please correct me if I am.
Title: Re: Packet information for masterlist?
Post by: Thijn on Feb 19, 2015, 08:38 PM
You're using VB.Net? For what?
Title: Re: Packet information for masterlist?
Post by: EK.IceFlake on Feb 20, 2015, 04:19 AM
Quote from: Thijn on Feb 19, 2015, 08:38 PMYou're using VB.Net? For what?
For handling the masterlist packets.
Title: Re: Packet information for masterlist?
Post by: Fuzzie on Feb 20, 2015, 05:10 AM
I don't think VB.Net would be ideal for handling JSON objects/string. JSON was created to work alongside Javascript. As a matter of fact, it is Javascript. You would have to create your own parser or find some JSON parser for VB.Net

Also, are you by any chance using Visual Basic to create an alternative for the VC-MP 0.4 Browser? If not, then why in the world do you need the data from the masterlist to be used with VB.Net?
Title: Re: Packet information for masterlist?
Post by: Stormeus on Feb 20, 2015, 08:19 AM
Quote from: NE.CrystalBlue on Feb 20, 2015, 04:19 AM
Quote from: Thijn on Feb 19, 2015, 08:38 PMYou're using VB.Net? For what?
For handling the masterlist packets.

You're making a masterlist server in Visual Basic? Or is this a browser? Either way, why?
Title: Re: Packet information for masterlist?
Post by: EK.IceFlake on Feb 20, 2015, 09:46 AM
Quote from: stormeus on Feb 20, 2015, 08:19 AM
Quote from: NE.CrystalBlue on Feb 20, 2015, 04:19 AM
Quote from: Thijn on Feb 19, 2015, 08:38 PMYou're using VB.Net? For what?
For handling the masterlist packets.

You're making a masterlist server in Visual Basic? Or is this a browser? Either way, why?
I am making a masterlist server to can on it when official masterlist is down etc. Maybe also release the masterlist
Title: Re: Packet information for masterlist?
Post by: . on Feb 20, 2015, 09:50 AM
Quote from: NE.CrystalBlue on Feb 20, 2015, 09:46 AMI am making a masterlist server to can on it when official masterlist is down etc. Maybe also release the masterlist

LMFAO. I'm very confident when I say that yours will probably have more downtime then the official one. Mainly because you plan on hosting it on your PC since you obviously have no idea about Linux or servers in general. Or maybe you have Windows server. Who knows. But I highly doubt it.
Title: Re: Packet information for masterlist?
Post by: EK.IceFlake on Feb 20, 2015, 10:11 AM
Quote from: S.L.C on Feb 20, 2015, 09:50 AM
Quote from: NE.CrystalBlue on Feb 20, 2015, 09:46 AMI am making a masterlist server to can on it when official masterlist is down etc. Maybe also release the masterlist

LMFAO. I'm very confident when I say that yours will probably have more downtime then the official one. Mainly because you plan on hosting it on your PC since you obviously have no idea about Linux or servers in general. Or maybe you have Windows server. Who knows. But I highly doubt it.
I dont care about it. I just want to know how to make my masterlist server.
Title: Re: Packet information for masterlist?
Post by: Fuzzie on Feb 20, 2015, 10:49 AM
If you are trying to achieve what VRocker did with the alternative VC-MP Server Browser than it's not that simple as it sounds. Actually it is from my perspective but I doubt you actually have the know how to do things like caching the masterlist every now and then, pinging the server to see if a response is received etc.
Title: Re: Packet information for masterlist?
Post by: ysc3839 on Feb 20, 2015, 03:48 PM
Quote from: NE.CrystalBlue on Feb 19, 2015, 11:14 AM@ysc3839
1. Analyzing is too hard
2. is {"success":true,"servers":[{"ip":"95.85.12.227","port":5192,"is_official":false},{"ip":"198.52.128.114","port":8192,"is_official":false},{"ip":"37.187.201.205","port":5194,"is_official":false},{"ip":"31.220.48.196","port":5176,"is_official":false},{"ip":"5.135.145.71","port":5200,"is_official":false},{"ip":"192.99.199.92","port":5724,"is_official":false},{"ip":"192.254.78.2","port":5190,"is_official":false},{"ip":"110.182.6.4","port":8192,"is_official":false},{"ip":"120.141.67.167","port":8192,"is_official":false},{"ip":"60.172.228.36","port":55555,"is_official":false}]} supposed to be sent as a string or something else? I am using VB.NET.
Thanks
It's json data. :)
Title: Re: Packet information for masterlist?
Post by: . on Feb 20, 2015, 04:37 PM
Quote from: ysc3839 on Feb 20, 2015, 03:48 PMIt's json data. :)

You're a bit late to the party aren't you?
Title: Re: Packet information for masterlist?
Post by: Stormeus on Feb 20, 2015, 09:13 PM
Quote from: NE.CrystalBlue on Feb 20, 2015, 10:11 AM
Quote from: S.L.C on Feb 20, 2015, 09:50 AM
Quote from: NE.CrystalBlue on Feb 20, 2015, 09:46 AMI am making a masterlist server to can on it when official masterlist is down etc. Maybe also release the masterlist

LMFAO. I'm very confident when I say that yours will probably have more downtime then the official one. Mainly because you plan on hosting it on your PC since you obviously have no idea about Linux or servers in general. Or maybe you have Windows server. Who knows. But I highly doubt it.
I dont care about it. I just want to know how to make my masterlist server.

In order to host a masterlist, you'll need a database to store servers that are online, and a method of verifying that these servers are actually online, such as querying servers as they announce themselves.

Here's an introduction to JSON (http://www.copterlabs.com/blog/json-what-it-is-how-it-works-how-to-use-it/). Here are the PHP functions for JSON (http://php.net/manual/en/ref.json.php). Here is a JSON framework for .NET languages (http://json.net) like Visual Basic. This is a description of the 0.4 server query protocol (http://wiki.vc-mp.org/wiki/Query_Mechanism), and linked within that article is a PHP class I wrote that handles query calls.

These are the accepted endpoints for the masterlist:

Quote/announce.php
Endpoint for servers to announce their existence to the masterlist. From here, the masterlist takes the information provided by the server to determine if it is online, if it is of the right version (0.4), and other factors such as if it has been banned from announcing.

Parameters
port (POST) - the port that the server is listening on; provided by the server and expected to exist
The IP address is implicitly provided as the IP address the HTTP request came from.

Expected Output
HTTP code of 200 OK if the masterlist approves the server. No other output is expected or parsed.

Errors
400 Bad Request if:
  • The announcing server does not specify a port.
  • The server uses a bad magic code (other than VCMP).
  • The server responds to the masterlist query, but the IP or port in the query response does not match the server making the masterlist query.

403 Forbidden if the user agent of the querying server is not VCMP/0.4.
405 Method Not Allowed if the server uses GET instead of POST for the port request.
408 Request Timeout if the masterlist timed out trying to query the VC:MP server.
500 Internal Server Error if any other error occurs trying to add the server to the masterlist.



/servers
Endpoint for the browser to retrieve a list of servers, in JSON format.

Parameters
None.

Expected Output
A JSON object with a "success" field set to true and a "servers" field with an array of objects containing "ip", "port", and "is_official" fields.

Example:
{
    "success": true,
    "servers": [
        {
            "ip":"127.0.0.1",
            "port":8192,
            "is_official":false
        }
    ]
}

Errors
A JSON object with a "success" field set to false, an "errorCode" field with a numeric error code, and an "error" field with a string representation of the error.

Example:
{
    "success": false,
    "errorCode": 2,
    "error": "Failed to query the masterlist database"
}



/official
Identical to /servers, except it only retrieves a list of servers marked as official.

Anything beyond this would be holding your hand through the programming process, as anyone with the proper programming background and this post would have more than enough information to create an alternative masterlist.