How to find mtu value of network through code(in python)?
问题 I have to write a code where I need to send data using udp protocol in python. I need to set the packet size to the MTU value of the network. Is there any way that I can decide the MTU value of the network writing some code in python? 回答1: This answer was taken from http://books.google.co.il/books?id=9HGUc8AO2xQC&pg=PA31&lpg=PA31&dq#v=onepage&q&f=false (page 31) s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) hostName = #ip here Port = 9999 s.connect((hostName, Port)) s.setsockopt(socket