[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Game server query problems

Randy W

2/15/2009 2:12:00 PM

[Note: parts of this message were removed to make it a legal post.]

Hello,
I'm relatively new to Ruby, so some of this is foreign, but despite trying
for several hours I can't seem to get this query to work.

My goal is to create a query that's consistent with this (
http://www.int64.org/docs/gamestat-protocols/gam...)

Here's the code I have so far:

require 'socket'

message = [0xFE,0xFD,0x00,0x43,0x4F,0x52,0x59,0xFF,0xFF,0x00].pack("c*")
socket = UDPsocket.new
socket.connect('64.34.186.176', 29900)
socket.send(message, 0)
receive = socket.recvfrom(1400)
puts receive

In return I should receive some data, but no matter how long I leave it
running I never get a response from the server. Apparently I'm doing
something wrong, but I can't seem to figure out what I'm messing up.

Any assistance is appreciated!

2 Answers

Jim Menard

2/15/2009 4:20:00 PM

0

Randy,

On Sun, Feb 15, 2009 at 9:11 AM, Randy W <randygeneral@gmail.com> wrote:
> Hello,
> I'm relatively new to Ruby, so some of this is foreign, but despite trying
> for several hours I can't seem to get this query to work.
>
> My goal is to create a query that's consistent with this (
> http://www.int64.org/docs/gamestat-protocols/gam...)
>
> Here's the code I have so far:
>
> require 'socket'
>
> message = [0xFE,0xFD,0x00,0x43,0x4F,0x52,0x59,0xFF,0xFF,0x00].pack("c*")
> socket = UDPsocket.new
> socket.connect('64.34.186.176', 29900)
> socket.send(message, 0)
> receive = socket.recvfrom(1400)
> puts receive

Try TCPSocket instead of using UDP.

>
> In return I should receive some data, but no matter how long I leave it
> running I never get a response from the server. Apparently I'm doing
> something wrong, but I can't seem to figure out what I'm messing up.
>
> Any assistance is appreciated!
>



--
Jim Menard, jimm@io.com, jim.menard@gmail.com
http://www.io....

Brian Candler

2/15/2009 8:48:00 PM

0

Randy W wrote:
> Hello,
> I'm relatively new to Ruby, so some of this is foreign, but despite
> trying
> for several hours I can't seem to get this query to work.
>
> My goal is to create a query that's consistent with this (
> http://www.int64.org/docs/gamestat-protocols/gam...)

Similar thread:
http://www.ruby-...to...
--
Posted via http://www.ruby-....