#encoding:utf-8
require 'thrift'
require File.expand_path('../../../gen-rb/xml_types', __FILE__) \
require File.expand_path('../../../gen-rb/xml_responce', __FILE__)
class XmlServerHandler
def initialize
end
def input(xml)
puts xml
'xml'
end
def output(xml)
puts xml
xml
end
def push()
print "
服務器已啟動"
end
end
def new_server
handler = XmlServerHandler.new
processor = XmlResponce::Processor.new(handler)
transport = Thrift::ServerSocket.new(9090)
transportFactory = Thrift::BufferedTransportFactory.new()
server = Thrift::SimpleServer.new(processor, transport, transportFactory)
puts "Starting the server..."
server.serve()
puts "done."
end