Surma
PS: Sorry I couldn't help with the actual problem
I guess you are right, I had followed suit with the http package... they
have built in Listen and serve calls for TLS which is essentially what I was
working on.
Is there another way to bind to this without a loop? I guess this is why I
got stuck here is I don't fully grasp how or why we need to use ServeConn in
this manner.
Surma
// Accept accepts connections on the listener and serves requests
// for each incoming connection. Accept blocks; the caller typically
// invokes it in a go statement.
func Accept(lis net.Listener) { server.accept(lis) }
func (server *serverType) accept(lis net.Listener) {
for {
conn, err := lis.Accept()
if err != nil {
log.Exit("rpc.Serve: accept:", err.String()) // TODO(r): exit?
}
go ServeConn(conn)
}
}
-----Original Message-----
From: Alexander Surma [mailto:alexand...@googlemail.com]
Sent: Friday, July 30, 2010 12:42 PM
To: Stephen Major
Cc: 'Alexander Surma'; golan...@googlegroups.com
Subject: Re: [go-nuts] Re: JSON-RPC over TLS socket
You don't have to loop with the standard rpc because the rpc package has
a *convenience function*. That is, it does the looping, the accepting of
the connection request, creating the codec (gob) and handling the rpc
request. jsonrpc does not have those convenience functions, which is why
you have to do all that on your on.
Maybe take a look at the rpc package source code in $GOROOT/src/pkg/rpc
Surma
On 7/30/10 22:35 , Stephen Major wrote:
> I didn't mean the looping being the libraries concern...
>
>
> The concern that I was addressing is an easy way for developers to implement
> a json-rpc server that is listening on a TLS socket, much like the http
> package has ListenandServeTLS
>
>
> I am still confused as to why we have to loop there to bind jsonrpc to the
> connection, we don't have to loop to bind standard rpc to the connection.
>
> Forgive me I come from a php shell scripting background and this is my first
> GO project, I am just having trouble understanding how the jsonrpc.ServeConn
> works and as to why we have to loop to bind it to the connection.
>
>
> --Stephen
>
> -----Original Message-----
> From: Alexander Surma [mailto:alexand...@googlemail.com]
> Sent: Friday, July 30, 2010 12:42 PM
> To: Stephen Major
> Cc: 'Alexander Surma'; golan...@googlegroups.com
> Subject: Re: [go-nuts] Re: JSON-RPC over TLS socket
>