summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsc2000-11-29 12:40:48 +0000
committersc2000-11-29 12:40:48 +0000
commitd0d03e43ecca9bfd78fa5a861b7914c6a1b90274 (patch)
tree1f089e538d22b538daeb6404c60ed07d166c1147
parent1ff8544ca3f8a524675f93420442cfd9ebd74fa2 (diff)
downloadivy-league-d0d03e43ecca9bfd78fa5a861b7914c6a1b90274.zip
ivy-league-d0d03e43ecca9bfd78fa5a861b7914c6a1b90274.tar.gz
ivy-league-d0d03e43ecca9bfd78fa5a861b7914c6a1b90274.tar.bz2
ivy-league-d0d03e43ecca9bfd78fa5a861b7914c6a1b90274.tar.xz
Just added some comments
-rw-r--r--comm/Socket.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/comm/Socket.cc b/comm/Socket.cc
index 61244fa..fc6f777 100644
--- a/comm/Socket.cc
+++ b/comm/Socket.cc
@@ -147,12 +147,15 @@ IvlSocket :: Bind (IvlAddress* addr)
int ret = bind (Fd, BAddr->GetSockAddr (), BAddr->Length ());
if (ret < 0)
return ret;
-
+
+ /* retrieve actual address that was allocated. This is useful if
+ ANYADDR was passed and we need to know the port number */
GEN_ADDR naddr;
socklen_t alen = sizeof (naddr);
if (getsockname (Fd, &naddr.sa, &alen) < 0)
return -1;
BindTo (IvlAddress::Decode (&naddr, alen));
+
return ret;
}
@@ -175,12 +178,15 @@ IvlSocket :: Connect (IvlAddress* addr)
int ret = connect (Fd, CAddr->GetSockAddr (), CAddr->Length ());
if (ret < 0)
return ret;
-
+
+ /* retrieve actual address that was allocated. This is useful if
+ ANYADDR was passed and we need to know the port number */
GEN_ADDR naddr;
socklen_t alen = sizeof (naddr);
if (getpeername (Fd, &naddr.sa, &alen) < 0)
return -1;
ConnectTo (IvlAddress::Decode (&naddr, alen));
+
return ret;
}