Click here to Skip to main content
15,559,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I'm using Net.Sockets TCPClient to record data from a instrument.
Because I need to continuously listen the output data from the instrument, then according to the data to communicate with some commands, I run the program with a thread(named Thread_A) and it seems work fine.

Becaused of some reasons, I want to send some commands manually with a button and get the reply from the Thread_A. I tried many methods but none worked, I think it because every TCP connection is independent.

When we use COM port, we can use a single port to communicate under a form. I'm wondering if it's possible to done the same way with TCPClient?
Or have any ideas to solve this question? Thanks!

What I have tried:

Tried many methods but none worked.
Posted
Comments
Richard MacCutchan 22-Dec-21 7:33am    
No, COM ports are static serial connections, TCP connections are dynamic. What you want to do may be possible, but it depends on how the instrument behaves when it receives a command from you.
Hu Christian 22-Dec-21 14:48pm    
Hi, Thanks for your reply, it saves me a lot of testing time. Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900