git » pytipc » commit 5b7f1dd

Use getsockname() in the examples

author Alberto Bertogli
2008-09-07 01:52:14 UTC
committer Alberto Bertogli
2008-09-07 02:01:26 UTC
parent 1bb1fa2870ae720ae0fe136b611dce959a2d12da

Use getsockname() in the examples

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

examples/rdm.py +2 -1
examples/stream.py +2 -1

diff --git a/examples/rdm.py b/examples/rdm.py
index 4e84eb6..cfb3cff 100755
--- a/examples/rdm.py
+++ b/examples/rdm.py
@@ -13,7 +13,7 @@ srvaddr = (tipc.TIPC_ADDR_NAMESEQ, 2000, 10, 100)
 def srv():
 	fd = tipc.socket(socket.SOCK_RDM)
 	fd.bind(srvaddr)
-	print 'server started'
+	print 'server started, addr:', fd.getsockname()
 
 	buf, addr = fd.recvfrom(1024)
 	while buf != "EXIT":
@@ -30,6 +30,7 @@ def cli():
 	print 'server up', evt
 
 	fd = tipc.socket(socket.SOCK_RDM)
+	print 'cli ready, addr:', fd.getsockname()
 	l = sys.stdin.readline()
 	while l:
 		fd.sendto(l.strip(), srvaddr)
diff --git a/examples/stream.py b/examples/stream.py
index 046095a..50cea6b 100755
--- a/examples/stream.py
+++ b/examples/stream.py
@@ -10,7 +10,7 @@ srvaddr = (tipc.TIPC_ADDR_NAME, 2000, 10, 0)
 def srv():
 	fd = tipc.socket(socket.SOCK_STREAM)
 	fd.bind(srvaddr)
-	print 'server started'
+	print 'server started, addr:', fd.getsockname()
 
 	fd.listen(5)
 	conn, addr = fd.accept()
@@ -31,6 +31,7 @@ def cli():
 	print 'server up', evt
 
 	fd = tipc.socket(socket.SOCK_STREAM)
+	print 'cli ready, addr:', fd.getsockname()
 	fd.connect(srvaddr)
 
 	l = sys.stdin.readline()