|
-
Apr 4th, 2008, 07:21 AM
#1
Thread Starter
New Member
Running MSComm_onComm and a TcpListener socket in a separate thread hangs program
I am working with the MSComm Control in VB.NET, and I also run a TcpListener object in a separate thread to listen for incoming requests in an infinite while loop and call MSComm commands when it has received requests to connect to the comm port, send certain commands through the comm port, and so on.
My problem is that when the event MSComm_onComm is raised continuously due to the fact that there is a constant stream of data coming in from the comm port, the whole program freezes.
This problem doesn't occur if I don't have the TcpListener object running, ie. MSComm_onComm runs without any problem at all.
Would appreciate it anyone could explain what is wrong, as I am a newbie at this, Thanks!
-
Apr 4th, 2008, 07:21 AM
#2
Re: Running MSComm_onComm and a TcpListener socket in a separate thread hangs program
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 4th, 2008, 07:36 AM
#3
Re: Running MSComm_onComm and a TcpListener socket in a separate thread hangs program
Why are you using TcpListener to listen to a serial port? That's just plain wrong...
What is your .net version? If you're coding .Net 2.0 or above, you can use the SerialPort class, which will automatically raises an event when it receives data.
-
Apr 4th, 2008, 03:50 PM
#4
Thread Starter
New Member
Re: Running MSComm_onComm and a TcpListener socket in a separate thread hangs program
Sorry if my question wasn't clear.
I'm using a TcpListener socket because I would like to be able to control the device which is connected through the serial port remotely. Is there a better method?
I'm using MSComm instead of the SerialPort library because I'm working with a partner's code and he has used MSComm, and I do not have the time now to rewrite his code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|