TCP non-blocking multithreads preemption



Hi,

I am designing an application with two threads running with different
priority. Each thread uses the same TCP address and port to send
information out (i know i can easily change to have different port,
but i just wanted to know what would happen if they use the same
port).


My question is what data would the TCP send buffer contains if one
thread is running non-blocking send operation while another thread
with higher priority happens to preempt the previous thread to do
another
non-blocking send operation.


For example,


Thread A has 10000 bytes to send. It is supposed to put 10000 bytes
to
the send buffer, but the window size is smaller than that, say it is
8000 bytes. So only 8000 bytes of 10000 bytes data is copied to the
send buffer and do the send operation for thread A.


While thread A is sending the 5000th bytes, thread B preempts it and
trys to send 4000 bytes of data. remember both thread A and thread B
are sharing the same connection with same address and port.


Would the send buffer look like 5000 bytes from A + 3000 bytes from B,
then after thread A is done sending 5000 bytes and thread B is done
sending 3000 bytes, the send buffer looks like 1000 bytes from B +
3000 bytes from A + 2000 bytes from A? or it has different scheme?


Remember both send operations are running on non-blocking mode. What
if both send operations are running on blocking mode?


Thanks
Ray

.



Relevant Pages

  • Re: TCP non-blocking multithreads preemption
    ... Each thread uses the same TCP address and port to send ... My question is what data would the TCP send buffer contains if one ... with higher priority happens to preempt the previous thread to do ...
    (comp.unix.programmer)
  • TCP non-blocking multithreads preemption
    ... Each thread uses the same TCP address and port to send ... My question is what data would the TCP send buffer contains if one ... with higher priority happens to preempt the previous thread to do ...
    (comp.unix.programmer)
  • TCP non-blocking multitreads priority pre-emption?
    ... Each thread uses the same TCP address and port to send ... My question is what data would the TCP send buffer contains if one ... with higher priority happens to preempt the previous thread to another ...
    (comp.os.linux.networking)
  • Re: Highly responsive serial port
    ... My problem consists of reading from a serial COM port as fluent as possible. ... If my reader only reads the input buffer after 50ms I'm too late to reply but I don't know it. ... Would a driver(in kernel mode) have enough priority to process such requests in time? ... a general rule of thumb in thread synchronization is to stay away from depending on "sleep" and loop designs in a vain attempt to synchronize I/O. ...
    (microsoft.public.win32.programmer.kernel)
  • Serial Communication in C# Express
    ... ago and I really appreciated Nicholas Paldino's help, ... > I can only achieve to transmit '34', ... After the usual port initialization, ... // Obtain the number of bytes waiting in the port's buffer ...
    (microsoft.public.dotnet.languages.csharp)