LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Multithreading and TCPIP

I am using TCPIP to communicate between two PCs on my firms network. The client is a multithreaded program simulating four test beds. Each of the test beds communicate OK individually with the server, but when they are running simultaneously I occassionally lose data between one of the threads and the server. I assume that this is because the server is busy whith one client when another client is trying to access it. My question then is twofold:

a) Are incoming messages not queued on a server? and
b) If not can I make them queue by, say, looking for a busy signal and delaying the server read until it has handled its current read?
0 Kudos
Message 1 of 2
(3,089 Views)

TCP guarantees reliable byte stream, not a reliable message stream.

Data should be queued until read.  When any thread reads the port, the data is "consumed", though I think there's a way to "sniff" a TCP port without consuming the data.

If you want messages, then use named pipes in message mode, which runs on top of tcp on windows machines.

tcp library is thread safe.

are you sure the client is thread safe?  No shared data or resources that are not protected?

Does each client thread have its own TCP connection, or are the threads sharing a connection?

menchar



Message Edited by menchar on 04-17-2008 09:31 AM
0 Kudos
Message 2 of 2
(3,065 Views)