aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_tcp_transport.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-04-06 22:58:12 +0200
committerLoïc Hoguin <[email protected]>2012-04-06 22:58:12 +0200
commit85ed79eb59cf2587b3c13558101eb1d78c95cfa6 (patch)
tree9d761579d26727d24897b9aa1925181d567927ad /src/cowboy_tcp_transport.erl
parente8ee64777c133a8bb05a1e6bc449c2c6a4a989db (diff)
parent06a2d636bce7a0494b960eae574fc092d25fcd7a (diff)
downloadcowboy-85ed79eb59cf2587b3c13558101eb1d78c95cfa6.tar.gz
cowboy-85ed79eb59cf2587b3c13558101eb1d78c95cfa6.tar.bz2
cowboy-85ed79eb59cf2587b3c13558101eb1d78c95cfa6.zip
Merge branch 'adt-add-sockname' of https://github.com/Vagabond/cowboy
Diffstat (limited to 'src/cowboy_tcp_transport.erl')
-rw-r--r--src/cowboy_tcp_transport.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cowboy_tcp_transport.erl b/src/cowboy_tcp_transport.erl
index 82d193b..f197dd1 100644
--- a/src/cowboy_tcp_transport.erl
+++ b/src/cowboy_tcp_transport.erl
@@ -20,7 +20,7 @@
-module(cowboy_tcp_transport).
-export([name/0, messages/0, listen/1, accept/2, recv/3, send/2, setopts/2,
- controlling_process/2, peername/1, close/1]).
+ controlling_process/2, peername/1, close/1, sockname/1]).
%% @doc Name of this transport API, <em>tcp</em>.
-spec name() -> tcp.
@@ -104,3 +104,10 @@ peername(Socket) ->
-spec close(inet:socket()) -> ok.
close(Socket) ->
gen_tcp:close(Socket).
+
+%% @doc Get the local address and port of a socket
+%% @see inet:sockname/1
+-spec sockname(inet:socket())
+ -> {ok, {inet:ip_address(), inet:port_number()}} | {error, atom()}.
+sockname(Socket) ->
+ inet:sockname(Socket).