sockets - The meaning of Java's DatagramChannel.write() -


i found code using datagramchannel.write(). code asked host ip , port before connected , allow sending (via datagramchannel.write()).

being new network programming, seemed odd wouldn't request destination ip/port. why not?

oracle's documentation states

this method may invoked if channel's socket connected, in case sends datagrams directly socket's peer.

what mean "the socket's peer"?

datagramchannel part of java.nio package. take parameter bytebuffer send connected channel. before trying send should connect using inetsocketaddress, takes host ip , port parameter. connect(socketaddress remote) --> connects channel underlying socket. can socket datagramchannel because channel non blocking io used read/write purpose. socket peer's nothing remote machine.


Comments

Popular posts from this blog

html - height not adding height to a empty div -

Oracle SQL. How to select specific IDs where value of columns specify criteria? -

python - Robot Framework location and name of keyword -