* sockets -> MTU (Maximum Transfer Unit)
@ 2003-07-25 1:19 ramzez
2003-07-25 3:06 ` Glynn Clements
0 siblings, 1 reply; 2+ messages in thread
From: ramzez @ 2003-07-25 1:19 UTC (permalink / raw)
To: linux-newbie, linux-c-programming
[-- Attachment #1: Type: text/plain, Size: 333 bytes --]
Hi friends...
In my C app, How do I can know the MTU (Maximum Transfer Unit) of my
net?
thanks
--
Linux User Registered #232544
ICQ : 337889406
GnuPG-key : www.keyserver.net
-------------------------------
"Software is like sex,
it's better when it's free."
[Linus Torvalds]
[-- Attachment #2: Esta parte del mensaje esta firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: sockets -> MTU (Maximum Transfer Unit)
2003-07-25 1:19 sockets -> MTU (Maximum Transfer Unit) ramzez
@ 2003-07-25 3:06 ` Glynn Clements
0 siblings, 0 replies; 2+ messages in thread
From: Glynn Clements @ 2003-07-25 3:06 UTC (permalink / raw)
To: ramzez; +Cc: linux-newbie, linux-c-programming
ramzez wrote:
> In my C app, How do I can know the MTU (Maximum Transfer Unit) of my
> net?
You can obtain the MTU of an interface with ioctl(SIOCGIFMTU), e.g.
const char if_name[] = "eth0";
struct ifreq ifr;
int fd;
fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
strcpy(ifr.ifr_name, if_name);
ioctl(fd, SIOCGIFMTU, &ifr);
printf("MTU of %s is %d\n", if_name, ifr.ifr_mtu);
Assuming that path MTU discovery is enabled, you can obtain the path
MTU of an individual connection using getsockopt(SOL_IP, IP_MTU), e.g.
int mtu;
int mtulen = sizeof(mtu);
getsockopt(skt, SOL_IP, IP_MTU, &mtu, &mtulen);
--
Glynn Clements <glynn.clements@virgin.net>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-07-25 3:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-25 1:19 sockets -> MTU (Maximum Transfer Unit) ramzez
2003-07-25 3:06 ` Glynn Clements
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.