I have the following ethernet network in order to communicate with PLCs(programmable logic controllers). One ethernet cable goes from PC to an ethernet switch and multiple cables go to PLCs in parallel from switch. Every PLC module has a different IP address and I want to communicate with them using TCP connections.
In code I create a TCPClient object for each module, by giving its IP, and connect to them before sending data. I want to create a seperate thread for each module and each thread will send data to its module using TcpClient.GetStream().Write method. Am I going to get the same Stream object when GetStream is called from each thread(as there is only one cable going out from PC) or there will be different Stream objects for each thread? If they will be different then I don’t need to synchronize between threads as the Stream object won’t be a shared resource. If that is the case, I assume that .net will do the synchronization between different Stream.Write calls because there is only one cable going out. Is this true? Additional information and links about the subject are welcome.
I have the following ethernet network in order to communicate with PLCs(programmable logic controllers).
Share
Different TcpClient objects, thus different streams. No synchronization is required. Multiplexing multiple TCP connections across one cable is the job of the TCP/IP driver stack built into the operating system. No need to help.