0

I'm very new in the network programming, i writed an IOCP network for Windows with c++, but i have a big contradiction;

many threads can send to same socket, so i used a lock before WSASend because i read about WSASend is not thread-safe, my question is, a thread calls WSASend and while send operation is in progress, if another thread calls WSASend again, what do i need to do?

Should i call WSASend for the second call, or do i need to add a queue and when its completed, send the cache?

What is the best performance tricks for iocp?

0sk1
  • 27
  • 1
  • 7
  • Is *is* thread-safe, or rather atomic, being a system call, but it's unlikely that the receiver will be able to make any sense of the resulting data stream. – user207421 Jul 04 '16 at 03:28
  • What do you mean any sense of the resulting data stream? And caching is should-must- technique for sending? – 0sk1 Jul 04 '16 at 03:37
  • The resulting stream will be an unparseable mess caused by an unpredictable sequence of operations by the sender. I have no idea what 'caching' is supposed to mean in your comment, or in title. A queue is not a cache. – user207421 Jul 05 '16 at 00:46

0 Answers0