<p>The <code>-connect</code> option overrides <code>-listen</code>; if you specify <code>-connect</code> then the daemon does not listen for connections.  So both your hosts are trying to connect to the other, but neither one is accepting connections.</p>

<p>If you use <code>-bind</code>, the daemon will accept connections on a particular interface, even if <code>-connect</code> is also specified.  </p>

<p>So let's suppose the two hosts have IP addresses 192.168.0.1 and 192.168.0.2 respectively.</p>

<p>On host1:</p>

<pre><code> mycoind -bind=192.168.0.1 -connect=192.168.0.2 -testnet -server
</code></pre>

<p>On host2:</p>

<pre><code> mycoind -bind=192.168.0.2 -connect=192.168.0.1 -testnet -server
</code></pre>

<p>I have tested this with <code>bitcoind</code> and it works.</p>

<p>Note that other machines on the 192.168.0 network will be able to connect to either host.  If it is a local network, this should not be a problem.  You will want to make sure that your router will not do port forwarding to port 8333 on either machine.  </p>

<p>You should also check firewall settings on both machines to make sure each will accept incoming connections from the other on port 8333.  (Actually, if just one of them will accept connections from the other, that should be sufficient.)</p>

CC BY-SA 3.0
2014-04-26T21:27:24.467Z
Hi! Thank for response! i tried and they can't connect to each other. in lsof -M -i i saw that both are Listening on p2p and rpc port.
milito
CC BY-SA 3.0
2014-04-26T21:29:44.327Z
If i turn off the pc i can see in debug.log that they can connect to each other. But when it's they connect and they want to send version blocks and other infos. But after that they disconnect.
milito
CC BY-SA 3.0
2014-04-26T21:31:58.010Z
@milito: Do you have the same problem with the standard `bitcoind` daemon?  If not, then the problem may be somewhere in the changes that you have made to the source, and there's not really any way we can help you with that.
Nate Eldredge
CC BY-SA 3.0
2014-04-26T22:01:05.970Z
i will check it now
milito
CC BY-SA 3.0
2014-04-27T16:41:59.897Z
Hi again!

I checked with the original source code and now they can connect and i see it in the getinfo, but they cant sync now. i got this in debug.log

connected 192.168.1.104:24070
send version message: version 71001, blocks=0, us=xx.xx.xx.xx:24070, them=0.0.0.0:0, peer=192.168.1.104:24070
socket closed
disconnecting node 192.168.1.104:24070
milito
CC BY-SA 3.0
2014-04-27T16:46:43.437Z
@milito: I'm out of ideas. Time for you to read the source and fire up a debugger, I guess.
Nate Eldredge
CC BY-SA 3.0
2014-04-28T15:49:36.837Z
Okay! It's not my problem! I searched the source code, no bug in there. Everything is works fine! But they cant sync. IN -lsof -M -i i see that both are listening on IPV4 and IPV6 on port 24071 wich is RPC port. Itried to connect with putting the port and the and of the ip both p2p or rpc and nothing. In conenction they can see each other but after i set generate the other will have 1 block and the other have 0 blocks.... After generating the merkle hash should i do something? i inserted nNonce, hash and genblockhash
milito
CC BY-SA 3.0
2014-04-26T15:11:10.040Z
2014-04-26T15:11:10.040Z
Nate Eldredge
<p>I am new here. I really want to know how scryptcoins work so i wanted to create and altcoin to learn on something. </p>

<p>I learned c++ years ago so i know i have some basic knowledge but sometimes i get stuck, and i need help.</p>

<p>Now i have a problem. I created my coin. I wanted to start on testnet on local network beetwen 2 pcs.</p>

<p>Server PC:</p>

<p>./xxxd -testnet -listen=1 -server=1 -connect=</p>

<p>Client PC</p>

<p>./xxxd -testnet -connect=</p>

<p>Than tried getinfo:</p>

<p>Conenctions: 0</p>

<p>The two pc can ping each other.</p>

<p>I tried other ways like:</p>

<p>Server PC:</p>

<p>./xxxd -testnet -connect=</p>

<p>Client PC</p>

<p>./xxxd -testnet -connect=</p>

<hr>

<p>Server PC:</p>

<p>./xxxd -testnet -listen=1 -server=1 -connect=:</p>

<p>Client PC</p>

<p>./xxxd -testnet -connect=:</p>

<p>In getinfo they didn't have any connections. I searched forums, topic and found nothing. </p>

<p>If you can help me, please write down your oppinion.</p>

CC BY-SA 3.0
2014-04-26T09:45:28.167Z
######debug log: server (with -daemon)#####

connected <clientip>:<port
send version message: version 71001, blocks=0, us=<mainip>:<port>, them=0.0.0.0:0, peer=<clientip>:<port>
socket closed
disconnecting node <clientip>:<port>

###ENDOFSERVERDEBUG######START client debug#####

connected <serverpeerip>:<port>
send version message: version 71001, blocks=0, us=<mainip>:<port>, them=0.0.0.0:0, peer=<serverpeerip>:<port>
socket closed
disconnecting node <serverpeerip>:<port>
milito
<blockchain>
How to establish connection for mining testnet blocks?
milito
# How to establish connection for mining testnet blocks?

(Asked by: username_0 on 2014-04-26)

I am new here. I really want to know how scryptcoins work so i wanted to create and altcoin to learn on something.

I learned c++ years ago so i know i have some basic knowledge but sometimes i get stuck, and i need help.

Now i have a problem. I created my coin. I wanted to start on testnet on local network beetwen 2 pcs.

Server PC:

./xxxd -testnet -listen=1 -server=1 -connect=

Client PC

./xxxd -testnet -connect=

Than tried getinfo:

Conenctions: 0

The two pc can ping each other.

I tried other ways like:

Server PC:

./xxxd -testnet -connect=

Client PC

./xxxd -testnet -connect=

---

Server PC:

./xxxd -testnet -listen=1 -server=1 -connect=:

Client PC

./xxxd -testnet -connect=:

In getinfo they didn't have any connections. I searched forums, topic and found nothing.

If you can help me, please write down your oppinion.

**Tags:** blockchain

> **Comments:**
> **username_0**: ######debug log: server (with -daemon)#####  connected <clientip>:<port send version message: version 71001, blocks=0, us=<mainip>:<port>, them=0.0.0.0:0, peer=<clientip>:<port> socket closed disconnecting node <clientip>:<port>  ###ENDOFSERVERDEBUG######START client debug#####  connected <serverpeerip>:<port> send version message: version 71001, blocks=0, us=<mainip>:<port>, them=0.0.0.0:0, peer=<serverpeerip>:<port> socket closed disconnecting node <serverpeerip>:<port>  

---

## 1 answers

### Answer by username_1 on 2014-04-26. Score: 1

The `-connect` option overrides `-listen`; if you specify `-connect` then the daemon does not listen for connections. So both your hosts are trying to connect to the other, but neither one is accepting connections.

If you use `-bind`, the daemon will accept connections on a particular interface, even if `-connect` is also specified.

So let's suppose the two hosts have IP addresses 192.168.0.1 and 192.168.0.2 respectively.

On host1:

```
 mycoind -bind=192.168.0.1 -connect=192.168.0.2 -testnet -server

```

On host2:

```
 mycoind -bind=192.168.0.2 -connect=192.168.0.1 -testnet -server

```

I have tested this with `bitcoind` and it works.

Note that other machines on the 192.168.0 network will be able to connect to either host. If it is a local network, this should not be a problem. You will want to make sure that your router will not do port forwarding to port 8333 on either machine.

You should also check firewall settings on both machines to make sure each will accept incoming connections from the other on port 8333. (Actually, if just one of them will accept connections from the other, that should be sufficient.)

> **Comments:**
> **username_0**: Hi! Thank for response! i tried and they can't connect to each other. in lsof -M -i i saw that both are Listening on p2p and rpc port.  
> **username_0**: If i turn off the pc i can see in debug.log that they can connect to each other. But when it's they connect and they want to send version blocks and other infos. But after that they disconnect.  
> **username_1**: @username_0: Do you have the same problem with the standard `bitcoind` daemon?  If not, then the problem may be somewhere in the changes that you have made to the source, and there's not really any way we can help you with that.  
> **username_0**: i will check it now  
> **username_0**: Hi again!  I checked with the original source code and now they can connect and i see it in the getinfo, but they cant sync now. i got this in debug.log  connected 192.168.1.104:24070 send version message: version 71001, blocks=0, us=xx.xx.xx.xx:24070, them=0.0.0.0:0, peer=192.168.1.104:24070 socket closed disconnecting node 192.168.1.104:24070  
> **username_1**: @username_0: I'm out of ideas. Time for you to read the source and fire up a debugger, I guess.  
> **username_0**: Okay! It's not my problem! I searched the source code, no bug in there. Everything is works fine! But they cant sync. IN -lsof -M -i i see that both are listening on IPV4 and IPV6 on port 24071 wich is RPC port. Itried to connect with putting the port and the and of the ip both p2p or rpc and nothing. In conenction they can see each other but after i set generate the other will have 1 block and the other have 0 blocks.... After generating the merkle hash should i do something? i inserted nNonce, hash and genblockhash  

---

