Re: Accessing com port with Sax Communication control

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Dave,
Thank you for replying to my message.

The reason I like to handle everything from the single control, because
additional port can be added to PC at any time. So application doesn't know
how many serial ports PC has.
Application should allow users to plug multiple scan guns and process
incoming data at the same time. Also data should be processed in order it
arrived.
I'm looking for any advice, how should I handle this task.

>I doubt it will work myself - with only 1 control, only 1 port can be open at a time, so the other 2 ports will be closed & just dump any incoming data.
So if can't open multiple ports with the single control at the same time,
Can I create instance of the control dynamically?
Something like this:

Dim sPorts() As String

'Getting available ports from config file
sPorts = Split("com1,com2,com3,com4,com5,com6,com7", ",")

For i = LBound(sPorts) To UBound(sPorts)
Dim sConnControl As New Sax.Communications.SerialConnection

sConnControl.Options = New
Sax.Communications.SerialOptions(sPorts(i).Trim, 9600, _
Sax.Communications.Parity.None, 8, _
Sax.Communications.CommStopBits.One, False,
False, True, False, True, True)

sConnControl.Open()

Next i

It will open all available ports, but 'Data Available' event won't fire up.
I'm using Sax.Communication.community library, that I downloaded with
Microsoft VB resource kit

ValK

"Dave Baker" wrote:

> On Mon, 25 Apr 2005 05:19:03 -0700, "ValK" <ValK@xxxxxxxxxxxxxxxxxxxxxxxxx>
> wrote:
>
> >I guess my question would be: How can I set multiple
> >connections to all ports with the single control? And
> >have some kind of event that will fired up if data
> >arrives to any of the ports.
>
> I doubt it will work myself - with only 1 control, only 1 port can be open at
> a time, so the other 2 ports will be closed & just dump any incoming data.
>
> Any special reason why you can't just use 3 controls?
>
> >I know that sax control
> >has 'Data Available' event, but I can't make it work.
> >It would be very helpful it you can share any examples
> >with me.
>
> Not much to give as an example - when data comes in, the data_available event
> fires. When you say that you can't make it work, are you saying that the
> event doesn't fire?
>
> Have you set up the port correctly (baud rate, flow control, etc), and opened
> it?
>
> And are you using sax.net with vb.net or saxcomm?
>
> Dave
>
> The email address used for sending these postings is not valid.
> All replies to the group please.
>
.


Quantcast