Skip to content

Commit f34f14d

Browse files
author
Ivan Bannikov
committed
Initial experimantal commit.
1 parent abc7556 commit f34f14d

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

.hosts.erlang

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
'localhost'.

epmd.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# coding: utf-8
2+
3+
import asyncio
4+
import functools
5+
6+
import bitstring
7+
8+
9+
class EPMDProtocol(asyncio.Protocol):
10+
11+
def __init__(self, loop):
12+
self.loop = loop
13+
14+
def connection_made(self, transport):
15+
print('Connecting to EPMD...')
16+
17+
18+
def data_received(self, data):
19+
print('Reived data: {!r}'.format(data.decode()))
20+
21+
def connection_lost(self, exc):
22+
print('Connection to EPMD closed')
23+
self.loop.stop()
24+
25+
26+
loop = asyncio.get_event_loop()
27+
28+
coro = loop.create_connection(
29+
functools.partial(EPMDProtocol, loop),
30+
'127.0.0.1',
31+
4369
32+
)
33+
34+
loop.run_until_complete(coro)
35+
loop.close()

0 commit comments

Comments
 (0)