Link to home
Start Free TrialLog in
Avatar of aseker
asekerFlag for Türkiye

asked on

Do I Have To Multithread ?

hi everybody

think about that there is one PC and 8 or 9 barcode scanners that are connected to that PC by com ports..i have to do some modifications on a table in my DB by the actions on com ports...

can i handle this by the way below or do i have to multithread ? if yes (multithread) how many threads do i have to design. for each port or a thread ? or for all ports a thread and a thread for other issues

    Private Sub port1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles Port.DataReceived
...
   DB modifications
...
    End Sub

    Private Sub port2_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles Port2.DataReceived
...
   DB modifications
...
    End Sub

.......
......
......

    Private Sub port9_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles Port9.DataReceived
...
   DB modifications
...
    End Sub
Avatar of cresQ
cresQ
Flag of Belgium image

Normaly you wont need to use multiple threads.
If i am correct, you connection to database creates something called like a pool.
This will manage your calls to and updates to the database

Greetz!
Avatar of aseker

ASKER

actually i dont worry about the DB side i worry about the data receive side. i mean if 2 or more com ports receives data at the same time, does this case brake my code?
ASKER CERTIFIED SOLUTION
Avatar of cresQ
cresQ
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aseker

ASKER

im not fully satisfied