Sha256: 90a1b7b1972b85cc364164e605bb99ad564eb6548e04155b965dc207ba2f5f84

Contents?: true

Size: 586 Bytes

Versions: 5

Compression:

Stored size: 586 Bytes

Contents

# $Id$
# Ruby-HL7 Proxy Server Example
require 'rubygems'
require 'ruby-hl7'
require 'thread'
require 'socket'

PORT = 2402
target_ip = "127.0.0.1"
target_port = 5900

srv = TCPServer.new(PORT)
puts "proxy_server listening on port: %i" % PORT
puts "proxying for: %s:%i" % [ target_ip, target_port ]
while true
  sok = srv.accept
  Thread.new( sok ) do |my_socket|
    raw_inp = my_socket.readlines
    msg = HL7::Message.new( raw_input )
    puts "forwarding message:\n%s" % msg.to_s
    soc = TCPSocket.open( target_ip, target_port )
    soc.write msg.to_mllp
    soc.close
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby-hl7-1.3.3 examples/proxy_server.rb
ruby-hl7-1.3.2 examples/proxy_server.rb
ruby-hl7-1.3.1 examples/proxy_server.rb
ruby-hl7-1.3.0 examples/proxy_server.rb
ruby-hl7-1.1.1 examples/proxy_server.rb