I use Web3 to connect to my remote server.
10.xxx.xxx.xxx
is ip address of a remote server.
First I start the server with this command :
parity --chain frontier.json --rpcapi="eth,net,web3,personal,web3" --rpc --rpcaddr 10.xxx.xxx.xxx --rpcport 8545 --rpccorsdomain "*" --author 0x...
And after I run a python script :
from web3 import Web3, KeepAliveRPCProvider
web3 = Web3(KeepAliveRPCProvider(host="163.xxx.xxx.xxx", port="8545"))
web3.eth.coinbase
But I've this error : ValueError: No JSON object could be decoded
If I remplace host by 10.xxx.xxx.xxx
I've socket.timeout: timed out
error
Moreover, if I install python and web3 on the remote server and run this command :
from web3 import Web3, KeepAliveRPCProvider
web3 = Web3(KeepAliveRPCProvider(host="10.xxx.xxx.xxx", port="8545"))
web3.eth.syncing
I don't have any error
But if I run this command on an other server I've the same error : socket.timeout: timed out
How can I resolve this error?
Best Answer
First double check that IP addresses are correct in your scripts.
Then use telnet command to ensure that you can connect to RPC port from the client computer:
You should see raw HTTP output and it should give you a hint of what could be wrong.
If this doesn't connect then fix whatever network/firewall/etc. issues you have between the computers.