EasyManua.ls Logo

YASKAWA MP3000 Series - Page 351

YASKAWA MP3000 Series
435 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
2.12 Communications with a Windows PC (Visual Basic Application)
Using Automatic Reception with the MP3000 as a Slave
2-333
Ethernet Communications
If (sock < 0) Then
MsgBox("Socket error " & WSAGetLastError())
Return -1
End If
'---- Bind the local port number and socket ----
rc = bind(sock, PC_addr, Len(PC_addr))
If (rc <> 0) Then
MsgBox("Bind error " & WSAGetLastError())
closesocket(0)
WSACleanup() ’Release the Winsock.DLL
Return -1
End If
'---- Establish connection ----
If (TransPort = 0) Then
rc = connect(sock, MP_addr, Len(MP_addr))
If (rc <> 0) Then
MsgBox("Connect error " & WSAGetLastError())
closesocket(0)
WSACleanup() ’Release the Winsock.DLL
Return -1
End If
End If
Return 0
End Function
'------------------------------------------------------------------------------
Send command data, receive response data
'------------------------------------------------------------------------------
Function MemobusMsg(ByVal TransPort As Short, ByRef Ssbuf As String, ByRef Srbuf As String) As Short
Dim rc As Short
If TransPort = 0 Then
rc = TcpMsg(Ssbuf, Srbuf)
Else
rc = UdpMsg(Ssbuf, Srbuf)
End If
Return rc
End Function
'------------------------------------------------------------------------------
Send command data, receive response data (TCP)
'------------------------------------------------------------------------------
Function TcpMsg(ByRef Ssbuf As String, ByRef Srbuf As String) As Short
Dim rc, slen As Integer
Dim rlen As Short

Table of Contents

Other manuals for YASKAWA MP3000 Series

Related product manuals