[erlang-questions] Getting the MTU of an IPv4 UDP socket?

Felix Lange <>
Wed Mar 23 21:56:05 CET 2011


You can use inet:getiflist/0 to get a list of all network interfaces.
Example (on my machine):

24> inet:getiflist().        
{ok,["lo0","en0"]}
25> inet:ifget("en0", [mtu]).
{ok,[{mtu,1500}]}

On 22 Mar 2011, at 14:47, Jachym Holecek wrote:

> # Jesper Louis Andersen 2011-03-22:
>> On Tue, Mar 22, 2011 at 22:18, Ivan Ostres <> wrote:
>> 
>>> MTU is defined on data-link layer, not on transport. If you don't want to do
>>> it with PMTU discovery, simplest way is to run "ifconfig" in shell, it shows
>>> MTU on OSX and it should do the same on Linux:
>>> 
>>> en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>> 
>> That is one way :) Is there one which is less involved, heh.
> 
> inet:ifget/N, but it seems you need to supply name of the underlying device too.
> 
> HTH,
> 	-- Jachym
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
> 



More information about the erlang-questions mailing list