BitShares Forum

Main => General Discussion => Topic started by: ThePiachu on January 15, 2015, 11:17:38 pm

Title: Connecting to the RPC server
Post by: ThePiachu on January 15, 2015, 11:17:38 pm
I am trying to connect to the BitShares RPC server using this python code: https://github.com/ThePiachu/BitJSONPy

I run BitShares, issue the command of

rpc_start_server 19988
rpc_set_username user
rpc_set_password pass

and in my python code, I call:

bitshares = jsonrpc.ServiceProxy("http://user:pass@127.0.0.1:19988/rpc")
print bitshares.info()

In response, I get an error of

IOError: ('http protocol error', 0, 'got a bad status line', None)

I tried connecting to the same URL using some Golang code, and it fails as well.

Does anyone have an idea what could be causing this error?
Title: Re: Connecting to the RPC server
Post by: jamesc on January 16, 2015, 12:09:23 am
remove "/rpc" https://github.com/ThePiachu/BitJSONPy/blob/master/hello/hello.py#L5
Title: Re: Connecting to the RPC server
Post by: ThePiachu on January 16, 2015, 12:15:25 am
remove "/rpc" https://github.com/ThePiachu/BitJSONPy/blob/master/hello/hello.py#L5

Tried, same error.
Title: Re: Connecting to the RPC server
Post by: jamesc on January 16, 2015, 01:09:19 am
Maybe golang requires a status header and the client does not send one.   I am not at the PC now...
Title: Re: Connecting to the RPC server
Post by: jamesc on January 16, 2015, 01:19:35 am
Also you should weigh pros and cons of http and Json port.   Http needs encoding and is a single command per connection unless you use the batch cmd, still single remote proc call type per connection.   Json need no headers but needs the login RPC call for many commands.  You use the id to track async commands in the same connection.   I saw a 20 fold improvement in a performance when getting balances for 101 local delegates.
Title: Re: Connecting to the RPC server
Post by: jamesc on January 16, 2015, 01:22:10 am
Vikram made a fix today that seems to stabilize the JSON port.