blob: a4dcc4428269325dd5015c9bb83cf38f9da90f5d [file] [log] [blame]
iproctor9a41a0c2007-07-16 21:59:24 +00001open Thrift
2
3class virtual t
iproctor7897c922007-08-08 01:43:39 +00004 (pf : Processor.t)
iproctor9a41a0c2007-07-16 21:59:24 +00005 (st : Transport.server_t)
iproctor7897c922007-08-08 01:43:39 +00006 (tf : Transport.factory)
iproctor9a41a0c2007-07-16 21:59:24 +00007 (ipf : Protocol.factory)
8 (opf : Protocol.factory)=
9object
iproctor9a41a0c2007-07-16 21:59:24 +000010 method virtual serve : unit
11end;;
12
13
iproctor7897c922007-08-08 01:43:39 +000014
iproctor9a41a0c2007-07-16 21:59:24 +000015let 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
20 while proc#process proto proto do () done;
21 ()
22 with e -> ()) (Unix.ADDR_INET (Unix.inet_addr_of_string "127.0.0.1",port))
23
24