I am using the Java Websockets library from https://github.com/TooTallNate/Java-WebSocket. I would like to calculate the latency between sending messages. When using the send(message);
function, will that wait until the server receives the packet (since it uses TCP), or does it just finish the method in it's own thread.
Thanks!
When using the send(message); function, will that wait until the server receives the method
That statement doesn't even make sense. The server doesn't receive the method, it receives the data the method sends.
(since it uses TCP)
There is nothing in the TCP API that waits for the peer to receive anything. When you send data via TCP, it is buffered in the local socket send buffer and returns immediately. The actual data is sent to the peer asynchronously over the network. The send blocks while the send buffer is full if the underlying socket is in blocking mode (the default), otherwise it either returns a short send return code in non-blocking mode, or posts a Future
of some kind in asynchronous mode. Your question may really be about which of these modes the underlying socket is in, or not.
or does it just finish the method in its own thread.
It always does that in any of the modes.