From: Nick Jackson Date: 2011-02-21T23:15:43+09:00 Subject: Using Ruby to connect with multiple IP Input output interface, Netiom. Hello all, I am trying to create an application written in ruby which communicates with multiple input/output interfaces over TCP/IP. The IO interface I am using is called a NETIOM. The interface has 16 digital inputs and 16 digital outputs. This code works for one Netiom device and is also able to detect inputs being pressed but the code exits after a little while. I have been experimenting with classes and arrays but not getting anywhere. require 'socket' server = TCPServer.open(3012) @socket = server.accept @socket.puts "SEND\r\n" while line = @socket.gets puts line.chop end this code returns: Digital inputs 1-8 : 11111111 Digital inputs 9-16: 11111111 Digital outputs 1-8 : 00000000 Digital outputs 9-16: 00000000 It would be great if I can have some help with the following: > handling multiple interfaces > being able to send a message to a single interface and then see its response > 'doing something' when an input is triggered and being able to identify which input and interface it was triggered on. Take a look at this for more info. http://stackoverflow.com/questions/5066943 I appreciate any help you can give me and many thanks for your time. Nick. -- Posted via http://www.ruby-forum.com/.