FZ_FormBase.ReceiveData
Performs an input of Byte type array data
Public Shared Function ReceiveData( _
ByVal ioIdent As String, _
ByRef inputData As Byte(), _
ByRef inputSize As Integer, _
ByVal parameter As Object, _
ByVal parameterSize As Integer _
) As Integer
Parameters
ioIdent
|
Type of input destination
ParallelIo: Parallel I/O
SerialNormal: Serial non-procedure communications
UdpNormal: Ethernet UDP non-procedure communications
|
Input
|
inputData
|
Input data
|
Output
|
inputSize
|
Input size
|
Output
|
parameter
|
Input condition parameter (optional)
* In case of UdpNormal, specify the IP address (example: "192.168.0.1") of the connection destination to the parameter as a string.
For other I/Os, do not specify the parameter as it is neglected.
|
Input
|
parameterSize
|
Input condition parameter size
|
Input
|
Return Value
Returns 0 when the data is successfully input.
Otherwise returns a non-zero value.
Description
Receives the data from the specified input destination.
Stores the received data into the array specified by argument inputData, and stores the received number of bytes into the variable specified by argument inputSize.
Example
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
Dim size As Integer
Dim data(256) As Byte
Dim value As String
' Inputs the data on parallel
ReceiveData("ParallelIO", data, size)
' Inputs the data on serial
ReceiveData("SerialNormal", data, size)
' Inputs data on Ethernet UDP
ReceiveData("UdpNormal", data, size, "192.168.0.1", 11*2)
' Transform the byte to string
value = System.Text.Encoding.ASCII.GetString(data, 0, size)
End Sub