Re: [hlds_linux] server info query.
I think it's because you need these to be separate if statements. The way you have written it, the if statements are nested. Try making them all stand-alone instead of nesting most of them under the if($EDF -band 0x80). On 10/29/2010 01:35 AM, edman747 wrote: It appears that both (-band, -and) work the same in this case. It never displays the messages about spectator port? or game tag? Still not to sure about the EDF of 145. On some servers I see 10 bytes after the EDF, two for the gameport and eight for the steamID. On other servers there are only two bytes after the EDF, the gameport. The script displays the correct game port, not sure why that is included since I had to send the info_query to that port. Guess I should display the ABS of the server steam ID. The 2nd AppID displays ok. except on my lan test server. It does not send the byte. if($EDF -band 0x80) # server game port { $i++ $portbyte1 = $receivebuffer[$i] $i++ $portbyte2 = $receivebuffer[$i] $2bytes = $portbyte1, $portbyte2 $info_gameport = [system.bitconverter]::ToInt16($2bytes,0) if($EDF -band 0x10) # server steam ID { $i++ $steamidbyte1 = $receivebuffer[$i] $i++ $steamidbyte2 = $receivebuffer[$i] $i++ $steamidbyte3 = $receivebuffer[$i] $i++ $steamidbyte4 = $receivebuffer[$i] $i++ $steamidbyte5 = $receivebuffer[$i] $i++ $steamidbyte6 = $receivebuffer[$i] $i++ $steamidbyte7 = $receivebuffer[$i] $i++ $steamidbyte8 = $receivebuffer[$i] $8bytes = $steamidbyte1,$steamidbyte2,$steamidbyte3,$steamidbyte4,$steamidbyte5,$steamidbyte6,$steamidbyte7,$steamidbyte8 $SteamID = [system.bitconverter]::toint16($8bytes,0) } if($EDF -band 0x40) # spectator port? { $null write-host spectator port? } if($EDF -band 0x20) # game tag? { $null write-host game tag? } if($EDF -band 0x01) # app ID two { $i++ [int16[]]$AppID2 = $receivebuffer[$i] } } output: Type: I Protocol Version: 48 Server Name: SC Test Server -DAL- [2815] Map: snark_pit Game Directory: SvenCoop4 Game Description: Sven Co-op 4.6 or later AppID: 70, 78 Number of players: 0 Maximum players: 24 Number of bots: 0 Dedicated: d OS: w Password: 1 Secure: 1 Game Version: 1.1.2.1 EDF: 145 gameport: 27015 SteamID: -10238 AppID2: 70 ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlds_linux -- Dave Parker Systems Administrator Utica College Integrated Information Technology Services (315) 792-3229 Registered Linux User #408177 ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlds_linux
Re: [hlds_linux] server info query.
Removed the nested if(s). The output is the same. I'm happy. To make it easier to see the raw data being received I Reduced the size of the receive buffer from 1400 bytes to 144 bytes. Looking at the sample output I see that the first three servers (sc4.6 test servers) reply to the info query with all the expected data. The next server (Raspberry's) sends an EDF of 144 rather than 145 like all the other servers? It does not send the 2nd AppID. And the last three do not send all of the extended data. They only send the server game port after the EDF. The script is configured to use a UDP slow link delay allowing ten seconds for a reply. A server sending an EDF of 144/145 there are usually three or four pieces of information in the extended data. The EDF does not change when the all the data is not sent. I already know the gameport (sent the info_query to it), Have no Idea what to do with the SteamID and I already have the AppID. Tested with a dummy-ed up receive buffer containing an EDF of 245 to check the other two items: ( EDF -band 0x40 ) and ( EDF -band 0x20 ) The extended data received varies from server to server and it is probably of little value, except as an exercise in understanding valve's documentation. Type: I Protocol Version: 48 Server Name: SC Test Server -DAL- [2815] Map: boot_camp Game Directory: SvenCoop4 Game Description: Sven Co-op 4.6 or later AppID: 70, 78 Number of players: 0 Number of bots: 0 Dedicated: d OS: w Password: 1 Secure: 1 Game Version: 1.1.2.1 EDF: 145, 95 gameport: 27015 SteamID: 19448 AppID2: 70 Raw Data: 255 255 255 255 73 48 83 67 32 84 101 115 116 32 83 101 114 118 101 114 32 45 68 65 76 45 32 91 50 56 49 53 93 0 98 111 111 116 95 99 97 109 112 0 83 118 101 110 67 111 111 112 52 0 83 118 101 110 32 67 111 45 111 112 32 52 46 54 32 111 114 32 108 97 116 101 114 0 70 0 0 24 0 100 119 1 1 49 46 49 46 50 46 49 0 145 135 105 8 180 77 232 182 9 64 1 70 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Type: I Protocol Version: 48 Server Name: SC Test Server -UK- [2815] Map: undertow Game Directory: SvenCoop4 Game Description: Sven Co-op 4.6 or later AppID: 70, 76 Number of players: 0 Number of bots: 0 Dedicated: d OS: w Password: 1 Secure: 1 Game Version: 1.1.2.1 EDF: 145, 93 gameport: 27015 SteamID: 5118 AppID2: 70 Raw Data: 255 255 255 255 73 48 83 67 32 84 101 115 116 32 83 101 114 118 101 114 32 45 85 75 45 32 91 50 56 49 53 93 0 117 110 100 101 114 116 111 119 0 83 118 101 110 67 111 111 112 52 0 83 118 101 110 32 67 111 45 111 112 32 52 46 54 32 111 114 32 108 97 116 101 114 0 70 0 0 24 0 100 119 1 1 49 46 49 46 50 46 49 0 145 135 105 2 236 147 179 182 9 64 1 70 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Type: I Protocol Version: 48 Server Name: Stealing jaffa cakes [trunk][2815] Map: crystal Game Directory: svencoop4 Game Description: Sven Co-op 4.6 or later AppID: 70, 83 Number of players: 0 Number of bots: 0 Dedicated: d OS: w Password: 1 Secure: 0 Game Version: 1.1.2.1 EDF: 145, 100 gameport: 27025 SteamID: 31732 AppID2: 70 Raw Data: 255 255 255 255 73 48 83 116 101 97 108 105 110 103 32 106 97 102 102 97 32 99 97 107 101 115 32 91 116 114 117 110 107 93 91 50 56 49 53 93 0 99 114 121 115 116 97 108 0 115 118 101 110 99 111 111 112 52 0 83 118 101 110 32 67 111 45 111 112 32 52 46 54 32 111 114 32 108 97 116 101 114 0 70 0 0 12 0 100 119 1 0 49 46 49 46 50 46 49 0 145 145 105 12 132 81 247 181 9 64 1 70 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Type: I Protocol Version: 48 Server Name: ..::[Raspberry's H(e)aven]::[ LESS 4.07, MOAR 4.5 ]::.. Map: -HL_OpFor_SP_Portal Game Directory: svencoop Game Description: Sven Co-op 4.5 AppID: 70, 112 Number of players: 0 Number of bots: 0 Dedicated: d OS: w Password: 0 Secure: 1 Game Version: 1.1.2.1 EDF: 144, 129 gameport: 27094 SteamID: 21494 AppID2: Raw Data: 255 255
Re: [hlds_linux] server info query.
I almost got it. There are no built in operators for bit shifting (,) in powershell v2. So it does not add two bytes well. as shown in the gameport and steamID output: $EDF = $ReceiveBuffer[$i] if($EDF -and 0x80) # servers game port number is included. { $i++ [int16[]]$gameport = $receivebuffer[$i] + $receivebuffer[$i++] if($EDF -and 0x10) # The server's SteamID { [int64[]]$SteamID = $receivebuffer[$i] + $receivebuffer[$i++] + $receivebuffer[$i++] + $receivebuffer[$i++] + $receivebuffer[$i++] + $receivebuffer[$i++] + $receivebuffer[$i++] + $receivebuffer[$i++] if($EDF -and 0x01) # The steam application IDhttp://developer.valvesoftware.com/wiki/Steam_Application_IDsagain { $i++;$i++ [int16[]]$AppID2 = $receivebuffer[$i] } } } output: Type: I Protocol Version: 48 Server Name: SC Test Server -DAL- [2815] Map: datacore Game Directory: SvenCoop4 Game Description: Sven Co-op 4.6 or later AppID: 70, 77 Number of players: 0 Maximum players: 24 Number of bots: 0 Dedicated: d OS: w Password: 1 Secure: 1 Game Version: 1.1.2.1 EDF: 145 gameport: 270 SteamID: 769 AppID2: 70 Thanks, ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlds_linux
Re: [hlds_linux] server info query.
You need to evaluate a bitwise AND of the EDF value and the various values defined in the A2S_INFO specification. I haven't done this in PowerShell, but a quick Google search for bitwise operations makes me think that you need to use -band (bitwise AND) instead of -and, like so: if($EDF -band 0x80) { # Server's game port is included } if($EDF -band 0x10) { # Server's SteamID is included } if($EDF -band 0x40) { # Spectator port and server name are included } if($EDF -band 0x20) { # Game tag data is included } Again, I haven't actually tried this, but I think the -band may be what you're looking for. - Dave - Original Message - From: edman747 edman...@gmail.com Date: Thursday, October 28, 2010 7:32 pm Subject: Re: [hlds_linux] server info query. To: Half-Life dedicated Linux server mailing list hlds_linux@list.valvesoftware.com I almost got it. There are no built in operators for bit shifting (,) in powershell v2. So it does not add two bytes well. as shown in the gameport and steamIDoutput: $EDF = $ReceiveBuffer[$i] if($EDF -and 0x80) # servers game port number is included. { $i++ [int16[]]$gameport = $receivebuffer[$i] + $receivebuffer[$i++] if($EDF -and 0x10) # The server's SteamID { [int64[]]$SteamID = $receivebuffer[$i] + $receivebuffer[$i++] + $receivebuffer[$i++] + $receivebuffer[$i++] + $receivebuffer[$i++] + $receivebuffer[$i++] + $receivebuffer[$i++] + $receivebuffer[$i++] if($EDF -and 0x01) # The steam application IDhttp://developer.valvesoftware.com/wiki/Steam_Application_IDsagain { $i++;$i++ [int16[]]$AppID2 = $receivebuffer[$i] } } } output: Type: I Protocol Version: 48 Server Name: SC Test Server -DAL- [2815] Map: datacore Game Directory: SvenCoop4 Game Description: Sven Co-op 4.6 or later AppID: 70, 77 Number of players: 0 Maximum players: 24 Number of bots: 0 Dedicated: d OS: w Password: 1 Secure: 1 Game Version: 1.1.2.1 EDF: 145 gameport: 270 SteamID: 769 AppID2: 70 Thanks, ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlds_linux ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlds_linux
Re: [hlds_linux] server info query.
It appears that both (-band, -and) work the same in this case. It never displays the messages about spectator port? or game tag? Still not to sure about the EDF of 145. On some servers I see 10 bytes after the EDF, two for the gameport and eight for the steamID. On other servers there are only two bytes after the EDF, the gameport. The script displays the correct game port, not sure why that is included since I had to send the info_query to that port. Guess I should display the ABS of the server steam ID. The 2nd AppID displays ok. except on my lan test server. It does not send the byte. if($EDF -band 0x80) # server game port { $i++ $portbyte1 = $receivebuffer[$i] $i++ $portbyte2 = $receivebuffer[$i] $2bytes = $portbyte1, $portbyte2 $info_gameport = [system.bitconverter]::ToInt16($2bytes,0) if($EDF -band 0x10) # server steam ID { $i++ $steamidbyte1 = $receivebuffer[$i] $i++ $steamidbyte2 = $receivebuffer[$i] $i++ $steamidbyte3 = $receivebuffer[$i] $i++ $steamidbyte4 = $receivebuffer[$i] $i++ $steamidbyte5 = $receivebuffer[$i] $i++ $steamidbyte6 = $receivebuffer[$i] $i++ $steamidbyte7 = $receivebuffer[$i] $i++ $steamidbyte8 = $receivebuffer[$i] $8bytes = $steamidbyte1,$steamidbyte2,$steamidbyte3,$steamidbyte4,$steamidbyte5,$steamidbyte6,$steamidbyte7,$steamidbyte8 $SteamID = [system.bitconverter]::toint16($8bytes,0) } if($EDF -band 0x40) # spectator port? { $null write-host spectator port? } if($EDF -band 0x20) # game tag? { $null write-host game tag? } if($EDF -band 0x01) # app ID two { $i++ [int16[]]$AppID2 = $receivebuffer[$i] } } output: Type: I Protocol Version: 48 Server Name: SC Test Server -DAL- [2815] Map: snark_pit Game Directory: SvenCoop4 Game Description: Sven Co-op 4.6 or later AppID: 70, 78 Number of players: 0 Maximum players: 24 Number of bots: 0 Dedicated: d OS: w Password: 1 Secure: 1 Game Version: 1.1.2.1 EDF: 145 gameport: 27015 SteamID: -10238 AppID2: 70 ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlds_linux
[hlds_linux] server info query.
hey, I hacked out a script to monitor local or remote servers. it is kinda simple it sends a ping gets the reply then sends an info query and gets the reply. If I can figure out the rcon stuff I will add that. It loops through the received UDP packet (a 1400 byte array) to get the four variable length strings (servername, mapname, directory, description) then searches for an appid that is equal to 70. After the appid is found it increments through the byte array one byte at a time to get and format the rest of the data. ref: [URL] http://developer.valvesoftware.com/wiki/Server_queries#Source_servers_2[/URL] Having a little trouble with the extended data flag. Is anyone familiar with how to read or check the extended data? TIA, note, in the samples the AppID shows two items 70, xx the xx is the byte where the appid was found. (this varies based on the length of the server and map names) sample output: Type: I Protocol Version: 48 Server Name: Stealing jaffa cakes [trunk][2813] Map: c0a0 Game Directory: svencoop4 Game Description: Sven Co-op 4.6 or later AppID: 70, 80 Number of players: 0 Maximum players: 12 Number of bots: 0 Dedicated: d OS: w Password: 1 Secure: 0 Game Version: 1.1.2.1 EDF: 145 Type: I Protocol Version: 48 Server Name: [FR]SvenCoop4.5 AMXX(2) Rcbot Map: jumpers Game Directory: svencoop Game Description: Sven Co-op 4.5 AppID: 70, 68 Number of players: 2 Maximum players: 12 Number of bots: 2 Dedicated: d OS: w Password: 0 Secure: 1 Game Version: 1.1.2.1 EDF: 145 Type: I Protocol Version: 48 Server Name: sc4.x Test Server[2814] Map: c0a0e Game Directory: svencoop4 Game Description: Sven Co-op 4.6 or later AppID: 70, 70 Number of players: 0 Maximum players: 12 Number of bots: 0 Dedicated: d OS: w Password: 0 Secure: 0 Game Version: 1.1.2.1 EDF: 145 Type: I Protocol Version: 48 Server Name: ..::[Raspberry's H(e)aven]::[ LESS 4.07, MOAR 4.5 ]::.. Map: -HL_OpFor_SP_Portal Game Directory: svencoop Game Description: Sven Co-op 4.5 AppID: 70, 112 Number of players: 0 Maximum players: 6 Number of bots: 0 Dedicated: d OS: w Password: 0 Secure: 1 Game Version: 1.1.2.1 EDF: 144 ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlds_linux
Re: [hlds_linux] server info query.
I've done this in Perl and Java. What language are you using? -Original Message- From: edman747 edman...@gmail.com To: Half-Life dedicated Linux server mailing list hlds_linux@list.valvesoftware.com Sent: Wed, 27 Oct 2010 10:08 PM Subject: [hlds_linux] server info query. hey, I hacked out a script to monitor local or remote servers. it is kinda simple it sends a ping gets the reply then sends an info query and gets the reply. If I can figure out the rcon stuff I will add that. It loops through the received UDP packet (a 1400 byte array) to get the four variable length strings (servername, mapname, directory, description) then searches for an appid that is equal to 70. After the appid is found it increments through the byte array one byte at a time to get and format the rest of the data. ref: [URL] http://developer.valvesoftware.com/wiki/Server_queries#Source_servers_2[/URL] Having a little trouble with the extended data flag. Is anyone familiar with how to read or check the extended data? TIA, note, in the samples the AppID shows two items 70, xx the xx is the byte where the appid was found. (this varies based on the length of the server and map names) sample output: Type: I Protocol Version: 48 Server Name: Stealing jaffa cakes [trunk][2813] Map: c0a0 Game Directory: svencoop4 Game Description: Sven Co-op 4.6 or later AppID: 70, 80 Number of players: 0 Maximum players: 12 Number of bots: 0 Dedicated: d OS: w Password: 1 Secure: 0 Game Version: 1.1.2.1 EDF: 145 Type: I Protocol Version: 48 Server Name: [FR]SvenCoop4.5 AMXX(2) Rcbot Map: jumpers Game Directory: svencoop Game Description: Sven Co-op 4.5 AppID: 70, 68 Number of players: 2 Maximum players: 12 Number of bots: 2 Dedicated: d OS: w Password: 0 Secure: 1 Game Version: 1.1.2.1 EDF: 145 Type: I Protocol Version: 48 Server Name: sc4.x Test Server[2814] Map: c0a0e Game Directory: svencoop4 Game Description: Sven Co-op 4.6 or later AppID: 70, 70 Number of players: 0 Maximum players: 12 Number of bots: 0 Dedicated: d OS: w Password: 0 Secure: 0 Game Version: 1.1.2.1 EDF: 145 Type: I Protocol Version: 48 Server Name: ..::[Raspberry's H(e)aven]::[ LESS 4.07, MOAR 4.5 ]::.. Map: -HL_OpFor_SP_Portal Game Directory: svencoop Game Description: Sven Co-op 4.5 AppID: 70, 112 Number of players: 0 Maximum players: 6 Number of bots: 0 Dedicated: d OS: w Password: 0 Secure: 1 Game Version: 1.1.2.1 EDF: 144 ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlds_linux ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlds_linux
Re: [hlds_linux] server info query.
I am using windows powershell 2.0 Worked as a Unix admin before I went back to school, I don't have a lot of windows keyboard time, I have to learn a new language. I can dump the raw data and see the additional bytes after the appid... the last thing I display is the EDF on most servers it is 145 on one it is 144. Not sure what to do with it? Thanks, ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlds_linux