Click here to Skip to main content
15,891,708 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hello Everyone,

I am trying to develop a program for sending a file through Serial port and read the same back. Here what i am doing is 1st sending the complete file through Serial Port and after that m reading it back. but if m sending large file then it creates a problem. I want to continuously fire the file and read the same back continuously and this is possible by using threads but i have never used it before. Can anyone pls help me with the Same?

If someone is not able to understand what m trying to do ask then do let me know>
Posted
Comments
Jochen Arndt 5-Oct-12 5:02am    
See this question http://www.codeproject.com/Questions/470848/Serial-Communication-issue I have just answered. The code snippets may be helpful for you to read data from a serial port using a worker thread.
Sergey Alexandrovich Kryukov 5-Oct-12 19:35pm    
Not clear what's the problem. Of course, use a separate thread; one thread for port is usually enough (and more than one per port can easily create problems if you are not extremely careful). You did not provide exact protocol to tell you something concrete, but it should not be a problem. Unfortunately, it's impossible to describe all the aspects of multithreading you can possibly face in one simple answer. Please read on threading and try to implement it by yourself (perhaps, not your task at first but some simple skeleton prototypes). It's not extremely difficult; most applications these days are multithreading. As it looks like you work in the field of control systems or data acquisition; and in this field there is simply nothing to do without multithreading. If you face problem -- ask a qustion; we will gladly help you.
--SA

1 solution

Please see my comments to the question. And start, for example, here:
http://msdn.microsoft.com/en-us/library/975t8ks0%28v=vs.110%29.aspx[^].

And don't even play with the idea of serial (or any other) communication applications without multithreading. Same thing is you need to do SCADA, data acquisition, control systems, networking, and a lot more. It looks like the time to start for you is now!

The best of luck for you,
—SA
 
Share this answer
 

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