?
-
What's the difference between Datagram.read and Datagram.receive?
What's the difference between Datagram.read and Datagram.receive?
Please post beginner questions to c.l.j.help, or at least make an
effort to read your API documentation before posting here.
Gordon said:Exactly what class is Datagram?
DatagramSocket has a receive() method that receives a DatagramPacket.
It has no read() method.
DatagramChannel has read(), write(), send() and receive().
read() and write() can only be used with connected sockets, and only
receive from (or send to) the socket's peer. That's why there is no
way to specify a destination address with write(), or obtain the
sender address with read().
send() and receive() are used with unconnected sockets, and can send
to any destination or receive from any source.
Please post beginner questions to c.l.j.help, or at least make an
effort to read your API documentation before posting here.
/gordon
I have read the API but my comprehension of what's written didn't help.
Gordon said:Now honestly, did those two sentences really not answer your original
question? I can hardly claim that my own explanation actually adds
anything of value to this one.
/gordon
Valid OPs for DatagramChannel are SelectionKey.OP_READ and
SelectionKey.OP_WRITE.
So how do i actually know the DatagramChannel.connect(..)'s method
has finished connecting?
Please post beginner questions to c.l.j.help, or at least make an
effort to read your API documentation before posting here.
Now honestly, did those two sentences really not answer your original
question? I can hardly claim that my own explanation actually adds
anything of value to this one.
Roedy said:He is more likely to have been reading up on DatagramSocket and
DatagramPacket which have been around longer than nio.
For a someone new coming in, it is not obvious there are two totally
different datagram schemes.
It does no good to tell someone they SHOULD understand something just
because you do. The fact remains they DON'T. Even if the docs read to
you like poetry, to them they are Greek. Bawling the guy out won't
make him any smarter. It will just discourage him.
The bitchy superiority going on in this group toward newbies
is counterproductive to Java succeeding.
If you want to chew someone out who REPEATEDLY refuses to even read
docs, or who lamely demands you do their homework, fine, blast them.
Until you provide a pointer to the relevant docs, you can't very well
accuse them of refusing to read. They have no clue what to look for.
They don't have the vocabulary to look. They have no idea if what
they are looking for even exists.
People post stuff here they would never say face to face.
Imagine someone at a help desk at a university handing out advice like
that given here putting down newbies.
He is more likely to have been reading up on DatagramSocket and
DatagramPacket which have been around longer than nio.
For a someone new coming in, it is not obvious there are two totally
different datagram schemes.
It does no good to tell someone they SHOULD understand something
just because you do. The fact remains they DON'T. Even if the docs
read to you like poetry, to them they are Greek. Bawling the guy out
won't make him any smarter. It will just discourage him.
The bitchy superiority going on in this group toward newbies
is counterproductive to Java succeeding.
You are setting the bar too high. Newbies do not attempt datagrams.
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.