dummy impl lmao lol funny commit message xD
This commit is contained in:
parent
4fe3b96832
commit
8b7407ba26
7 changed files with 221 additions and 13 deletions
|
|
@ -1,18 +1,27 @@
|
|||
defmodule P2pChat do
|
||||
@moduledoc """
|
||||
Documentation for `P2pChat`.
|
||||
"""
|
||||
|
||||
@doc """
|
||||
Hello world.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> P2pChat.hello()
|
||||
:world
|
||||
|
||||
"""
|
||||
def hello do
|
||||
:world
|
||||
{:ok, pid1} = P2pChat.Transport.start_link(port: 12345)
|
||||
netid1 = P2pChat.Transport.get_netid(pid1)
|
||||
|
||||
{:ok, pid2} = P2pChat.Transport.start_link(port: 12346)
|
||||
netid2 = P2pChat.Transport.get_netid(pid2)
|
||||
|
||||
# {:ok, addr4} = :inet.parse_address ~c"2600::"
|
||||
# {:ok, addr6} = :inet.parse_address ~c"9.9.9.9"
|
||||
{:ok, addr6} = :inet.parse_address ~c"::"
|
||||
{:ok, addr4} = :inet.parse_address ~c"127.0.0.1"
|
||||
|
||||
P2pChat.Transport.add_neighbor(pid1, netid2, {addr4, 12346})
|
||||
P2pChat.Transport.add_neighbor(pid1, netid2, {addr6, 12346})
|
||||
|
||||
Process.sleep(500)
|
||||
P2pChat.Transport.inform_about_self(pid1)
|
||||
|
||||
Process.sleep(500)
|
||||
neighbors2 = P2pChat.Transport.get_neighbors(pid2)
|
||||
IO.inspect(neighbors2)
|
||||
|
||||
GenServer.stop(pid1)
|
||||
GenServer.stop(pid2)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue