Re: [MacRuby-devel] MacRuby-devel Digest, Vol 32, Issue 7
Hi Rob, Thanks for the fix. I did have the require up top, but I neglected to copy it. Thanks for the typo catch! Shaun On Sat, Oct 2, 2010 at 7:42 PM, <macruby-devel-request@lists.macosforge.org>wrote:
Send MacRuby-devel mailing list submissions to macruby-devel@lists.macosforge.org
To subscribe or unsubscribe via the World Wide Web, visit http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel or, via email, send a message with subject or body 'help' to macruby-devel-request@lists.macosforge.org
You can reach the person managing the list at macruby-devel-owner@lists.macosforge.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of MacRuby-devel digest..."
Today's Topics:
1. Socket Class not implimented? (Shaun August) 2. Re: Socket Class not implimented? (Rob Gleeson) 3. Re: Socket Class not implimented? (Rob Gleeson)
----------------------------------------------------------------------
Message: 1 Date: Sat, 2 Oct 2010 19:36:19 -0700 From: Shaun August <shaun@eoslightmedia.com> To: macruby-devel@lists.macosforge.org Subject: [MacRuby-devel] Socket Class not implimented? Message-ID: <AANLkTinqSiHgdaS_fG=AoNgcfPwr2YNYPmwnH-4sCgbF@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1"
Hi There,
I am trying to run a ruby TCPsocket to get information from a quatech serial device server. The code runs well in ruby but I get an error when I try to reference the class in my MacRuby code:
uninitialized constant Coin_Counter::TCPsocket (NameError)
Here is the class where the error takes place:
class Coin_Counter def open_socket(host) port=(5000)
@s = TCPsocket.open(host, port) puts "Opened Connection to", host,"\n" end
def close_socket() @s.close end
def poll_microcoin() hexBool = true byteNum = 0 coins = true loonie = 0 hex = "\x82\x88\x90\xff\x90\x00\x03\x77" hex1 = "\x82\x88\x11\xff\x90\x00\x03\xf6"
while coins eof = false if hexBool @s.write(hex) hexBool = false else @s.write(hex1) hexBool = true end
while eof == false results = @s.read(1) if byteNum == 5 if results == "\030" AppController.startImageCapture elsif results == "\220" loonie = loonie + 1 if loonie > 1 AppController.startImageCapture loonie = 0 end end end if results == "\003" p "end of bytes" eof = true byteNum = byteNum + 1 end byteNum = byteNum + 1 end check = @s.read(1) byteNum = 0 sleep(0.5) end end end
I really need to use raw TCP sockets to communicate with my device. I am hoping I don't have to re-impliment this code.
Thanks for your help,
Shaun
participants (1)
-
Shaun August