Click to See Complete Forum and Search --> : fetching a server list...
mu_ds
Nov 25th, 2006, 07:33 PM
hi!
i have a multiplayer game almost ready it uses winsock.
not only the game is client/server but after you login its gonna fetch a list with all game servers and details so you can choose(and also allow way more players if the game grows)... the question is.....
1-Should i fetch the list file using http or ftp?? (my isp blocks port 80 and im on a lan)....ugh it would be unstable FOR ME...to server a file thru http in my main server...
2-Should i just get the list directly with winsock?? (notice there is a MAIN server. other game servers stay connected to the main server and the main connects to a db so the game servers dont connect to the db directly cuz it would be easier to hack that way)...but the thing is...clients would also need to stay connected this way wich is kinda mad in case of thousands of players at the same time..
3-is it dumb to generate the game list to a file in a folder and serve it thru ftp? isnt it slower to serve or is it faster??
well thx in advance :wave:
the182guy
Nov 26th, 2006, 09:16 AM
Your ISP blocks port 80? - get a new isp LOL!
What do you mean, why not connect to the server directly with winsock, and get the list that way? It wont be port 80 im sure. You could connect to it so that the game server thinks your a one if its users using the official game client
mu_ds
Nov 27th, 2006, 11:03 AM
Your ISP blocks port 80? - get a new isp LOL!
What do you mean, why not connect to the server directly with winsock, and get the list that way? It wont be port 80 im sure. You could connect to it so that the game server thinks your a one if its users using the official game client
in the country i live i dont have another option for now.
i was thinking its not right to leave all the global players connected to a main winsock server because some say there is a limit of 255 wich im not sure of..
or in case there's thousands of players wouldnt it be mad to leave them connected just to get a list 1 time(and refreshing time to time)??..
the plan was to report clients as logged in to the db and then discing the main server, and while seeing the server list then choosing any server...
and what you said about connecting them as clients would work, and game servers would have to remain connected in another port..but i dont know what really happens if there are thousands of clients connected to that winsock...but actually if they are connected but not sending data is it the same for the server as if they arent?
the game servers will remain connected because im sure they wont be that many.
another solution would be to have both game servers and clients connected to the main server. and just send a different autentication..and that way just get the list and do other operations..
ugh sorry if i type 2 much, im just curious lol. but would i really need separated ports for server and clients in the case im using it thru winsock..
and would i need to just connect..get the file..and disc right there...
or leave hundreds or thounsands of clients connected?
thx in advanced :wave:
DigiRev
Nov 27th, 2006, 07:28 PM
:confused:
There is no 255 limit when working with Winsocks. You are limited by the data type of the array index (which is integer), and/or the amount of memory on the server.
I'm a little confused about how your game is setup, but when fetching a server list (from the master/main server), you can compress the data pretty easily using the code below. This will save a lot of bandwidth over time.
Basically, the idea is to compress the IP address of each server into 4 bytes. so:
123.123.123.123 - 15 bytes becomes only 4 bytes. That's almost 4 times as small.
Here's some code:
Option Explicit
'Compresses a standard IP (ie: 123.123.123.123 into 4 bytes)
'ie: Chr$(123) & Chr$(123) & Chr$(123) & Chr$(123)
Private Function PackIP(ByVal IPAddress As String) As String
Dim strBuff() As String
strBuff() = Split(IPAddress, ".")
PackIP = Chr$(CInt(strBuff(0))) & Chr$(CInt(strBuff(1))) & Chr$(CInt(strBuff(2))) & Chr$(CInt(strBuff(3)))
End Function
'Decompresses a compressed IP Chr$(123) & Chr$(123) & Chr$(123) into:
'123.123.123.123
Private Function UnpackIP(ByVal PackedIP As String) As String
Dim int1 As Integer, int2 As Integer
Dim int3 As Integer, int4 As Integer
If Len(PackedIP) <> 4 Then Exit Function
int1 = Asc(Left$(PackedIP, 1))
int2 = Asc(Mid$(PackedIP, 2, 1))
int3 = Asc(Mid$(PackedIP, 3, 1))
int4 = Asc(Right$(PackedIP, 1))
UnpackIP = int1 & "." & int2 & "." & int3 & "." & int4
End Function
Private Sub Form_Load()
Dim strIP As String
'Some random IP address.
strIP = "43.220.192.168"
Dim strCompIP As String, strUnComp As String
'Compress the IP.
strCompIP = PackIP(strIP)
MsgBox strCompIP, , "Compressed IP"
'Decompress the IP.
strUnComp = UnpackIP(strCompIP)
MsgBox strUnComp, , "Uncompressed"
End Sub
It would help to have a clear understanding of how you have your game setup.
mu_ds
Nov 27th, 2006, 10:30 PM
thats a pretty good idea that i forgot about man.thx for that.. i will put here a fast resume of the overal games networking so hopefully i can be underestood more..thx for confirming that there is no limit..it seems it depends a lot on memory..
and now:
http://www.vbforums.com/attachment.php?attachmentid=52697
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.