ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/Socket.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent/Socket.pm (file contents):
Revision 1.139 by root, Thu Aug 25 03:08:48 2011 UTC vs.
Revision 1.140 by root, Thu Sep 1 22:09:26 2011 UTC

1052 defined wantarray && guard { %state = () } 1052 defined wantarray && guard { %state = () }
1053} 1053}
1054 1054
1055=item $guard = tcp_server $host, $service, $accept_cb[, $prepare_cb] 1055=item $guard = tcp_server $host, $service, $accept_cb[, $prepare_cb]
1056 1056
1057Create and bind a stream socket to the given host, and port, set the 1057Create and bind a stream socket to the given host address and port, set
1058SO_REUSEADDR flag (if applicable) and call C<listen>. Unlike the name 1058the SO_REUSEADDR flag (if applicable) and call C<listen>. Unlike the name
1059implies, this function can also bind on UNIX domain sockets. 1059implies, this function can also bind on UNIX domain sockets.
1060 1060
1061For internet sockets, C<$host> must be an IPv4 or IPv6 address (or 1061For internet sockets, C<$host> must be an IPv4 or IPv6 address (or
1062C<undef>, in which case it binds either to C<0> or to C<::>, depending 1062C<undef>, in which case it binds either to C<0> or to C<::>, depending
1063on whether IPv4 or IPv6 is the preferred protocol, and maybe to both in 1063on whether IPv4 or IPv6 is the preferred protocol, and maybe to both in
1064future versions, as applicable). 1064future versions, as applicable).
1065 1065
1066To bind to the IPv4 wildcard address, use C<0>, to bind to the IPv6 1066To bind to the IPv4 wildcard address, use C<0>, to bind to the IPv6
1067wildcard address, use C<::>. 1067wildcard address, use C<::>.
1068 1068
1069The port is specified by C<$service>, which must be either a service name or 1069The port is specified by C<$service>, which must be either a service name
1070a numeric port number (or C<0> or C<undef>, in which case an ephemeral 1070or a numeric port number (or C<0> or C<undef>, in which case an ephemeral
1071port will be used). 1071port will be used).
1072 1072
1073For UNIX domain sockets, C<$host> must be C<unix/> and C<$service> must be 1073For UNIX domain sockets, C<$host> must be C<unix/> and C<$service> must be
1074the absolute pathname of the socket. This function will try to C<unlink> 1074the absolute pathname of the socket. This function will try to C<unlink>
1075the socket before it tries to bind to it, and will try to unlink it after 1075the socket before it tries to bind to it, and will try to unlink it after

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines