IP header

J

Janko Nedic

I'm trying to make sure that my packets don't get broken up
in the network. I know that this can be done by setting
the "don't fragment" bit in the IP header but I don't know
how to access this from Java ... any ideas? Also if you
have an idea of how to do this differently (apart from
changing the system wide setting) your ideas will be
appreciated!

Cheers,
Ned
 
R

Roedy Green

I'm trying to make sure that my packets don't get broken up
in the network. I know that this can be done by setting
the "don't fragment" bit in the IP header but I don't know
how to access this from Java ... any ideas? Also if you
have an idea of how to do this differently (apart from
changing the system wide setting) your ideas will be
appreciated!

Java gives you UDP and TCP/IP but does not let you down to the IP
level.

Whether to split packets or not is a decision best left to the
routers. It knows the most efficient way to handle things. What you
want to control is the MTU, (the starting packet size) which you can
experiment with by using a program like TweakDun. See
http://mindprod.com/jgloss/tweakdun.html
 
S

Steve Horsley

Janko said:
I'm trying to make sure that my packets don't get broken up
in the network. I know that this can be done by setting
the "don't fragment" bit in the IP header but I don't know
how to access this from Java ... any ideas? Also if you
have an idea of how to do this differently (apart from
changing the system wide setting) your ideas will be
appreciated!

Cheers,
Ned

I would advise you to look for a fix such that you don't need
to avoid fragmentation. Remeber that the only alternative to
fragmentation is to discard the packet - fragmentation is
only done when necessary.

In addition, large blocks of data (e.g. writing a 2K byte[])
are likely to be fragmented in the sending computer before ever
reaching the network.

It sounds like you are assuming that you can find a way that
a single write() will always produce a single read() response.
Forget it. Fix your wire protocol by sending explicit message
delimiters. Then you can cope with both fregmentation and
concatenation without error. Both can happen in TCP.

Steve.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top