úÎKÃGÅ5      !"#$%&'()*+,-./01234portable experimentalpxqr.sta@gmail.comNone=KResponse used to signal that callee successufully process a F procedure call and to return values from procedure. KResponse should F not be sent if error occurred during RPC. Thus KResponse may be only  sent from server to client. .Responses are encoded as bencoded dictionary: , { "y" : "r", "r" : [<val1>, <val2>, ...] } @Query used to signal that caller want to make procedure call to E callee and pass arguments in. Therefore query may be only sent from 5 client to server but not in the opposite direction. ,Queries are encoded as bencoded dictionary: C { "y" : "q", "q" : "<method_name>", "a" : [<arg1>, <arg2>, ...] } BErrors used to signal that some error occurred while processing a B procedure call. Error may be send only from server to client but  not in the opposite direction. +Errors are encoded as bencoded dictionary: D { "y" : "e", "e" : [<error_code>, <human_readable_error_reason>] } 2Occur when client trying to call method server don't know. 2Malformed packet, invalid arguments or bad token. 2Occur when server fail to process procedure call. Some error doesn't fit in any other category. JRun server using a given port. Method invocation should be done manually. !56 789Port number to listen.  Handler. :;<     56  789:;<portable experimentalpxqr.sta@gmail.comNone2Procedure signature and implementation binded up. +Address of remote can be called by client. =Represent any error mentioned by protocol specification that  $, await might throw.  For more details see . =1Alias to Socket, through might change in future. =Method datatype used to describe name, parameters and return / values of procedure. Client use a method to invoke , server   implements% the method to make the actual work. :We use the following fantom types to ensure type-safiety: < param: Type of method parameters. Ordinary Tuple type used 8 to specify more than one parameter, so for example Method  (Int, Int) result will take two arguments. 8 result: Type of return value of the method. Similarly, > tuple used to specify more than one return value, so for  exsample Method (Foo, Bar) (Bar, Foo) will take two arguments  and return two values. >To pass raw dictionaries you should specify empty param list:  4 method "my_method" [] [] :: Method BEncode BEncode CIn this case you should handle dictionary extraction by hand, both  in client and server. Name used in query. Name of each parameter in  right to left order. !Name of each return value in  right to left order. "5Identity procedure signature. Could be used for echo  servers. Implemented as:  idM = method "id" ["x"] ["y"] #AMakes method signature. Note that order of parameters and return E values are not important as long as corresponding names and types : are match. For exsample this is the equal definitions:  ) methodA : Method (Foo, Bar) (Baz, Quux) 3 methodA = method "mymethod" ["a", "b"] ["c", "d"] ) methodA : Method (Bar, Foo) (Quux, Baz) 3 methodB = method "mymethod" ["b", "a"] ["d", "c"] $>Makes remote procedure call. Throws RPCException on any error  occurred. % The same as $ but use already opened socket. &6Assign method implementation to the method signature. ' Similar to '' but additionally pass caller address. (<Run RPC server on specified port by using list of handlers. E Server will dispatch procedure specified by callee, but note that 6 it will not create new thread for each connection. >= !?"#@ABCDEF$Address of callee. Procedure to call. )Arguments passed by callee to procedure. .Values returned by callee from the procedure. %Socket to use Address of callee. Procedure to call. )Arguments passed by callee to procedure. .Values returned by callee from the procedure. & Signature. Implementation. Handler used by server. ' Signature. Implementation. Handler used by server. (*Port used to accept incoming connections. Method table. GHI !"#$%&'( !#"$&'(%>= !?"#@ABCDEF$%&'(GHIportable experimentalpxqr.sta@gmail.comNone0+Used to validate any message by its scheme  forall m. m 2 scheme m 1Get a message scheme. 2Check a message with a scheme. )*+,-./012J34KLM )*+,-./01234 012,-./3)*+4 )*+,-./012J34KLMN      !!""#$%&'()*+,--.//0123456 789:;<=>?@ABCDEFGHIJKLMN krpc-0.4.1.0Network.KRPC.Protocol Network.KRPCNetwork.KRPC.Scheme Remote.KRPCProtocolKRemote KRemoteAddr KResponserespValsValNameKQuery queryMethod queryArgs ParamName MethodName ErrorCodeKError MethodUnknown ProtocolError ServerError GenericError errorMessage errorCodemkKErrorkquery kresponse withRemote sendMessage recvResponse remoteServer MethodHandler RemoteAddr RPCExceptionMethod methodName methodParams methodValsidMmethodcallcall_==>==>@serverKResponseSchemerscVals KQueryScheme qscMethod qscParamsKMessageschemevalidatemethodQuerySchememethodRespScheme serverErrorsockAddrFamily maxMsgSize$fBEncodeKResponse$fBEncodeKQuery$fBEncodeKErrorRemote HandlerBody showsMethod lookupKey extractArgszipBDict injectValsinvalidParamList queryCall getResult$fExceptionRPCException $fShowMethod$fBEncodeMethod bdictKeys"$fKMessageKResponseKResponseScheme$fKMessageKQueryKQueryScheme$fKMessageKErrorInt