aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2013-08-26 12:09:14 +1000
committerSteve Bennett <steveb@workware.net.au>2013-08-28 08:28:30 +1000
commit9a5f6d477a47592f3e835b3e61005e1562faf7d7 (patch)
tree8c1fd2bb521704997056520cabb99f4a9867b621
parent9f6a391ea48da29f46aa92a500df91a944e39307 (diff)
downloadjimtcl-9a5f6d477a47592f3e835b3e61005e1562faf7d7.zip
jimtcl-9a5f6d477a47592f3e835b3e61005e1562faf7d7.tar.gz
jimtcl-9a5f6d477a47592f3e835b3e61005e1562faf7d7.tar.bz2
Fix aio recvfrom for non-inet socket
Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r--jim-aio.c6
-rw-r--r--jim_tcl.txt6
2 files changed, 8 insertions, 4 deletions
diff --git a/jim-aio.c b/jim-aio.c
index 9f3dcc8..a52baf1 100644
--- a/jim-aio.c
+++ b/jim-aio.c
@@ -561,11 +561,15 @@ static int aio_cmd_recvfrom(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
}
else
#endif
- {
+ if (sa.sa.sa_family == PF_INET) {
/* Allow 7 for :65535\0 */
inet_ntop(sa.sa.sa_family, &sa.sin.sin_addr, addrbuf, sizeof(addrbuf) - 7);
snprintf(addrbuf + strlen(addrbuf), 7, ":%d", ntohs(sa.sin.sin_port));
}
+ else {
+ /* recvfrom still works on unix domain sockets, etc */
+ addrbuf[0] = 0;
+ }
if (Jim_SetVariable(interp, argv[1], Jim_NewStringObj(interp, addrbuf, -1)) != JIM_OK) {
return JIM_ERR;
diff --git a/jim_tcl.txt b/jim_tcl.txt
index 5c5344d..a7c3249 100644
--- a/jim_tcl.txt
+++ b/jim_tcl.txt
@@ -4461,9 +4461,9 @@ aio
+$handle *seek* 'offset' *?start|current|end?*+::
Seeks in the stream (default 'current')
-+$handle *sendto* 'str ?hostname:?port'+::
++$handle *sendto* 'str ?addr:?port'+::
Sends the string, +'str'+, to the given address via the socket using sendto(2).
- This is intended for udp sockets and may give an error or behave in unintended
+ This is intended for udp/dgram sockets and may give an error or behave in unintended
ways for other handle types.
Returns the number of bytes written.
@@ -4561,7 +4561,7 @@ Various socket types may be created.
A unix domain socket server.
+*socket ?-ipv6? stream* 'addr:port'+::
- A TCP socket client.
+ A TCP socket client. (See the forms for +'addr'+ below)
+*socket ?-ipv6? stream.server* '?addr:?port'+::
A TCP socket server (+'addr'+ defaults to +0.0.0.0+ for IPv4 or +[::]+ for IPv6).