Skip to content Skip to sidebar Skip to footer

Python : Is It Ok To Threads Read/write Simultaneously To Same Tcp Socket?

I want to have a reader thread & a writer thread to same TCP socket. Is it ok? Do I need to lock before accessing it ? Platform is Windows 7, CPython 2.7.4

Solution 1:

For Unix kernel two threads one reading and other writing to a file (socket) is same as two processes doing the same. As the kernel is capable of Multiplexing the IO you don't need to worry.


Post a Comment for "Python : Is It Ok To Threads Read/write Simultaneously To Same Tcp Socket?"