I am trying to write a software in c Language which do two tasks at the same time.
It first function is initializing a socket in windows and listing for incoming connection,
Second function is monitoring hardware output connected to the COM 1 and if he got something it should write to a file. Both should happen same time.
If a user connected then to the listing socket he will get the report of lst 10 events of the file which is updated by the COM monitor and write function.
Second function is fully independent from first function.
I have coded the both functions separately, tested, and working well. When I run function 1(listing for incoming connection) function 2 is remain stop mode. If func 2 runs fun 1 remain stop mode. (procedural programming)
I need to do this both run in same time using threads or processes in a one programme (one executable file).
Can I do this with threads?
I have tried so many ways to find this. Msdn also not giving good reference to me to do this.
If Some one knows well pls help me to do this - guide me the way fo doing this in th coding. I am expecting a well described answer form you all.
func1() --network listing
func2() --monitoring com1 and updating file.
Then how can I code a Programme to do both in independently without exiting each other?????