iproctor | 9a41a0c | 2007-07-16 21:59:24 +0000 | [diff] [blame] | 1 | open Thrift |
| 2 | |
| 3 | class virtual t |
iproctor | 7897c92 | 2007-08-08 01:43:39 +0000 | [diff] [blame] | 4 | (pf : Processor.t) |
iproctor | 9a41a0c | 2007-07-16 21:59:24 +0000 | [diff] [blame] | 5 | (st : Transport.server_t) |
iproctor | 7897c92 | 2007-08-08 01:43:39 +0000 | [diff] [blame] | 6 | (tf : Transport.factory) |
iproctor | 9a41a0c | 2007-07-16 21:59:24 +0000 | [diff] [blame] | 7 | (ipf : Protocol.factory) |
| 8 | (opf : Protocol.factory)= |
| 9 | object |
iproctor | 9a41a0c | 2007-07-16 21:59:24 +0000 | [diff] [blame] | 10 | method virtual serve : unit |
| 11 | end;; |
| 12 | |
| 13 | |
iproctor | 7897c92 | 2007-08-08 01:43:39 +0000 | [diff] [blame] | 14 | |
iproctor | 9a41a0c | 2007-07-16 21:59:24 +0000 | [diff] [blame] | 15 | let run_basic_server proc port = |
| 16 | Unix.establish_server (fun inp -> fun out -> |
| 17 | let trans = new TChannelTransport.t (inp,out) in |
| 18 | let proto = new TBinaryProtocol.t (trans :> Transport.t) in |
| 19 | try |
iproctor | e470aa3 | 2007-08-10 20:48:12 +0000 | [diff] [blame^] | 20 | while proc#process proto proto do () done; () |
iproctor | 9a41a0c | 2007-07-16 21:59:24 +0000 | [diff] [blame] | 21 | with e -> ()) (Unix.ADDR_INET (Unix.inet_addr_of_string "127.0.0.1",port)) |
| 22 | |
| 23 | |