Last active
August 29, 2015 13:57
-
-
Save teepark/9556847 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# creating a hub: | |
# | |
hub = junction.Hub( | |
[ # first argument: listening "sites" | |
"tcp://127.0.0.1:9000", # TCP/IP host:port | |
"udp://127.0.0.1:9000", # UDP/IP host:port | |
"tcp:///var/run/stream.sock", # STREAM /path/to/socketfile | |
"udp:///var/run/dgram.sock", # DGRAM /path/to/socketfile | |
(3, 4), # (read-from, write-to) file descriptors (usually pipes) | |
], | |
[ # second argument: connect to these other Hubs' "sites" | |
"tcp://127.0.0.1:9000", # TCP/IP host:port | |
"udp://127.0.0.1:9000", # UDP/IP host:port | |
"tcp:///var/run/stream.sock", # STREAM /path/to/socketfile | |
"udp:///var/run/dgram.sock", # DGRAM /path/to/socketfile | |
(3, 4), # (read-from, write-to) file descriptors (usually pipes) | |
] | |
) | |
# | |
# creating a client: | |
# | |
# single argument, some hub's "site" | |
client = junction.Client("tcp://127.0.0.1:9000") # connect via TCP/IP | |
client = junction.Client("udp://127.0.0.1:9000") # connect via UDP/IP | |
client = junction.Client("tcp:///var/run/stream.sock") # connect via a STREAM sockfile | |
client = junction.Client("udp:///var/run/stream.sock") # connect via a DGRAM sockfile | |
client = junction.Client((3, 4)) # use (read-from, write-to) file descriptors for connection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment