IDK MSD-804FD User Manual
Page 9
MSD-804FD Users Guide (Command Guide)
9
69: 'Extract fro @ to CRLF
70: If ((InStr(pRecvMsg, vbCrLf) <> 0) And (InStr(pRecvMsg, "@") <> 0))
Then
71: pRecvMsg = Mid(pRecvMsg, _
72: InStr(pRecvMsg, "@"), _
73: InStr(pRecvMsg, vbCrLf) _
74: - InStr(pRecvMsg, "@"))
75: Exit Do
76: End If
77: End If
78: End If
79: Loop
80: mSendMessege = pRecvMsg
‘Retun received data
81:
82: Catch ex As Exception
83: Console.WriteLine(ex.Message) ‘Display exception processing
84: End Try
85:
86: End Function
87: Public Sub mClose()
88: : '*******************************************************
89: ' Close
90: '*******************************************************
91: Try
92: If Not stns Is Nothing Then
'Check if there is stream
93: stns.Close()
'Close stream
94: End If
95:
96: If Not stClient Is Nothing Then
'Check if there is client
97: stClient.Close()
'Close cliant
98: End If
99:
100: Catch ex As Exception
101: Console.WriteLine(ex.Message)
'Display exception processing
102: : End Try
103:
104: End Sub
105: : Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
106: Dim wRecvMsg As String 'Store area fir received character strings
107: Dim i As Integer
108: Dim wHostName As String
109: Dim wPortNum As Integer
110:
111: If (TextBox2.Text = "") Then
'Check host name
112: MsgBox("Host name not registered")
113: : Exit Sub
114: : End If
115:
116: wHostName = TextBox2.Text
117:
118: If (TextBox3.Text = "") Then
'Check port number
119: MsgBox("Port number not registered")
120: Exit Sub
121: End If
122: wPortNum = Val(TextBox3.Text)
123:
124: If TextBox1.Text = "" Then
'Check sent character string
125: MsgBox("Sent character not registeered")
126: Exit Sub
127: End If
128:
129: Label6.Text = ""
130:
131: For i = 0 To 2
'Retries 3 times (If all ports of MSD-804FD are used by other cliants)
132: If Not mOpen(wHostName, wPortNum) Then
133: MsgBox("Communication open error")
134: GoTo Exit_Step
135: End If
136: