Niklas Therning <[EMAIL PROTECTED]> a écrit :
[EMAIL PROTECTED] wrote:
Niklas Therning <[EMAIL PROTECTED]> a écrit :
[EMAIL PROTECTED] wrote:
Hi,
when I receive the 'messageSent' notification, what is its semantic?
Does it mean that the receiving end has received the message (from
a TCP point
of view, i.e. that all bytes have been received)?
Regards,
J-F
No, it only means that the message has been written to the
SocketChannel corresponding to the session. There's no guarantee
that the receiving side has received any of the message bytes yet.
/Niklas
Thanks Niklas.
Some clarifications:
- Is it possible to know when message has really been received?
No, I don't think so unless you add some kind of acknowledge message
to your protocol.
Do you mean that when the call
socket.getOutputStream().write(myBufferOf1000Bytes) returns, it does not mean
that all 1000 bytes has been transmitted via TCP/IP to receiver?
What does it mean then? That the 1000 bytes are in TCP/IP stack's buffer?
- If not why? Is it due to TCP/IP, OS, sockets, use of non-blocking I/O ?
Well, I'm not an expert on TCP/IP but from what I know I think it
will be hard and require very low level programming to achieve that
kind of control. The Java abstraction of Socket IO (both blocking and
non-blocking) is too high-level.
I guess one would have to map packet sequence numbers to messages and
then be able to intercept acknowledges of sent packets to do what you
want. I'm not sure if OS:es allows you to get that kind of control.
But as I said, I'm no expert on TCP/IP so please correct me if I'm wrong.
/Niklas