SComm32 Communications OCX

   







Properties/Methods

. Break
. CDHolding
. Commevent
. CommName
. CommPort
. CTSHolding
. DSRHolding
. DTREnable
. EOFChar
. EOFEnable
. EvtChar
. EvtCharEnable
. Handshaking
. InBufferCount
. InBufferSize
. Input
. InputLen
. InputMode
. NullDiscard
. OutBufferCount
. OutBufferSize
. Output
. Output
. ParityReplace
. PortOpen
. Read
. RThreshold
. RTSEnable
. Settings
. SThreshold

OnComm Event
Hardware/Cables etc
Loopback Test Plug

EOFChar

Sets or Retrieves the character that will indicate EOF (End of File) - Used in conjuntion with the EOFEnable property

Available at Design time and Runtime.

Only available using the SComm32 ocx. Not supported by MSComm32
 

Syntax:-

SComm1.EOFChar = value

value = SComm1.EOFChar
 

value:- A numeric value. ASCII Values 0 to 255 (Default is 26)
 
Example:-

SComm1.EOFEnable = True

SComm1.EOFChar = 4
 


Remarks:

MSComm32 is old and therefore still uses the standard Win3/Dos EOF char (Ascii char 26). Modern file systems do not require or use the EOF character to indicate the End of File but some communications protocols may use EOF or, more likely, some other ascii character as a way to indicate 'End of Message' or 'End of Transmision'.

The Ascii table has a number of such characters such as ETX ( 3 ) and EOT ( 4 ) and SComm32 allows you to use any ascii character.

See also the EOFEnable property. If enabled this property will cause an OnComm event to be triggered when the EOFChar is read by the Input property.

It is important to note that the OnComm event is raise AFTER the character was read by the Input property.

Example: Lets assume we're receiving an unknown amount of data which we expect to be terminated by the ASCII EOT (4) character. We don't want to waste time inspecting every individual character to see if it's EOT. We'll simply store all incoming data in a textbox and use the evEof OnComm event to tell us when the EOT character has arrived.

    '// Set these values via the IDE or elsewhere in your code such as Form_Load event

InputLen = 0
    '// we will read all available chars from the buffer each time we call Input

RThreshold = 1
   '// we want OnComm events when any data arrives.

EOFEnable = True
EOFChar = 4
    '// We're ging to react to the ascii EOT character

Private Sub Comm1_OnComm

    Select Case Comm1.CommEvent

        Case evReceive
            Text1.Text = Text1.Text & Comm1.Input

        Case evEof
             '// When this event occurs it means the EOFchar
             '// was received and added to Text1
             '// We can now do any processing we want with
             '// the data.

    End Select
End Sub