Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: c107b71803
Fetching contributors…

Cannot retrieve contributors at this time

22 lines (17 sloc) 0.454 kb
-module(port).
-export([open/2,
close/1
]).
-record(port,{type :: echo,
socket :: gen_tcp:socket(),
number :: integer()
}).
-spec(open(integer(),atom() | string()) -> {ok,gen_tcp:socket()}).
open(Port,echo) ->
{ok,Sock} = gen_tcp:listen(Port,[{active,false}]),
{ok,#port{ type = echo,
socket = Sock,
number = Port}}.
-spec(close(#port{}) -> ok).
close(Port) ->
gen_tcp:close(Port#port.socket).
Jump to Line
Something went wrong with that request. Please try again.