Agilent Technologies 4294A Programming Manual page 183

Precision impedance analyzer
Hide thumbs Also See for 4294A:
Table of Contents

Advertisement

Example 12-5
RecvAscii
Function RecvAscii(dataBuf As String, ByVal maxLength As Integer) As Integer
End Function
Disconnection
The subprogram corresponding to disconnection is CloseConnection (Example 12-6).
CloseConnection uses the closesocket function of WinSock API to disconnect communication, and
deletes the socket. The parameter for the closesocket function is Socket Descriptor (input).
Example 12-6
CloseConnection
Sub CloseConnection()
End Sub
End
The subprogram corresponding to end is EndIt (Example 12-7). EndIt uses the WSACleanup of
WinSock API to disconnect WinSock API. WSACleanup must always be executed at the end of
WinSock.
Example 12-7
EndIt
Sub EndIt()
End Sub
Chapter 12
Dim c As String * 1
Dim length As Integer
dataBuf = ""
While length < maxLength
DoEvents
count = recv(socketId, c, 1, 0)
If count < 1 Then
RecvAscii = RECV_ERROR
dataBuf = Chr$(0)
Exit Function
End If
If c = Chr$(10) Then
dataBuf = dataBuf + Chr$(0)
RecvAscii = NO_ERROR
Exit Function
End If
length = length + count
dataBuf = dataBuf + c
Wend
RecvAscii = RECV_ERROR
x = closesocket(socketId)
If x = SOCKET_ERROR Then
MsgBox ("ERROR: closesocket = " + Str$(x))
Exit Sub
End If
'Shutdown Winsock DLL
x = WSACleanup()
Using LAN
Controlling the Agilent 4294A
'
'
'...................(1)
'
'
'
'
'...................(2)
'
'
'
'...................(3)
'
183

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents