webForumDet fria alternativet

Öppna sockets

5 svar · 285 visningar · startad av Nickemannen

NickemannenMedlem sedan aug. 20003 575 inlägg
#1

tänkte fråga hur man öppnar sockets..

tänkte göra något liknande

http://www.webforum.nu/showthread.php?s=&threadid=15950&highlight=CounterStrike+info

i .NET ?

renholmMedlem sedan apr. 20012 266 inlägg
#2

Jag har försökt med UdpClient men fick inte något vidare resultat, ska testa igen med TcpClienten via UDP protokollet.

Här är en specifikation på hur protkollet fungerar:

HL SDK skrev:

Game servers will answer the following messages:
Messages are sent to the server by sending 4 consecutive bytes of 255
(32-bit integer -1) and then the string command followed by a zero byte
to terminate it

"ping"
Server responds with a single byte code ASCII 'j'

"info"
Server responds with the following packet:
(int32) -1
(byte) ASCII 'C' (info response, S2A_INFO)
(string) net address of server
(string) name of the host / server
(string) name of the map
(string) game directory (i.e. valve/)
(string) Game description (e.g. "half-life multiplay")
(byte) active client count
(byte) maximum clients allowed
(byte) protocol version (currently 7)

"players"
Server responds with the following packet:
(int32) -1
(byte) ASCII 'D' (players response, S2A_PLAYER)
(byte) active client count

for each active client
(byte) client number / index
(string) player name
(int32) client's frag total
(float32) client's total time in-game

"rules"
Server responds with the following packet:
(int32) -1
(byte) ASCII 'E' (rules response, S2A_RULES)
(int16) number of rules

for each rule
(string) rule name
(string) rule value

NickemannenMedlem sedan aug. 20003 575 inlägg
#3

tack!

NickemannenMedlem sedan aug. 20003 575 inlägg
#4

Ett tips istället för att bara skicka

"info"

skicka

"infostring" istället man får mer data då
t.ex. vad det är för OS, Dedicerad eller ej, lösenord eller ej osv

renholmMedlem sedan apr. 20012 266 inlägg
#5

ok, något nytt i HL protokollet?

Tack för tipet...

NickemannenMedlem sedan aug. 20003 575 inlägg
#6

vet inte, jag ville veta hur man laddade ner hela HL-server listan
Så jag fick tag på alla ip som fanns så jag satte en sniffer på min UDP och uppdaterade listan och då såg jag att hl skickade infostring istället för bara info.

Plus att jag kom på att man måste ju kunna se om den körs av en windows eller linux, dedicerad eller ej i hl listan

133 ms totalt · 3 externa anrop · v20260731065814-full.30151723
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
130 ms — hämta tråd, inlägg och bilagor (db)