📄 ctcpsrv.htm
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 2.0">
<title>Class CTCPIPServer</title>
</head>
<body bgcolor="#FFFFFF">
<p align="center"><font size="4"><strong>Class CTCPIPServer</strong></font></p>
<p align="left"><font size="3">This class manages TCP/IP serial
port interface. It's not possible to create instances of
CTCPIPServer directly using VBA "New" function , that
means , it's not a creatable class. You must use </font><a
href="svrmtd.htm#mbussrv.CreateTCPServer"><font size="3">CreateTCPServer</font></a><font
size="3"> method from Modbus Server class.</font></p>
<p align="left"> </p>
<p align="center"><font size="6"><strong>Properties</strong></font></p>
<p align="left"><font size="5"><strong>GetLocalHostIP</strong></font></p>
<p align="left"><font size="3"><strong>syntax</strong></font></p>
<p align="left"><font size="3">TcpServer.GetLocalHostIP</font></p>
<p align="left"><font size="3">HRESULT
GetLocalHostIP([out,retval] BSTR* pbstrVal);</font></p>
<p align="left"><font size="3"><strong>Remarks</strong></font></p>
<p align="left"><font size="3">This property is intended to find
the IP address of the computer where was installed the Modbus
Server. It was used two api functions: gethostname, gethostbyname
to find IP Address. If the function fails a loopback address
127.0.0.1 is returned. </font></p>
<p align="left"><font size="3"><strong>Data Type </strong></font></p>
<p align="left"><font size="3"><strong>String</strong></font></p>
<p align="left"><font size="5"><strong>ServerAddress</strong></font></p>
<p align="left"><font size="3">TcpServer.ServerAddress[=ServerAddress$]</font></p>
<p align="left"><font size="3">HRESULT ServerAddress([out,
retval] BSTR *pVal);<br>
HRESULT ServerAddress([in] BSTR newVal);</font></p>
<p align="left"><font size="3">Get/Set Server address. The TCP
serial port interface do not automatically detect the ip address
of the computer where the server was installed. You have to set
this address before calling StartServer method. Generally you can
set this property with the value returned by GetLocalHostIP but
sometimes this not work.</font></p>
<p align="left"><font size="3"><strong>Data Type </strong></font></p>
<p align="left"><font size="3">String </font></p>
<p align="left"><font size="5"><strong>ServerPort</strong></font></p>
<p align="left"><font size="3">TcpServer.ServerPort[=ServerPort</font>&<font
size="3">]</font></p>
<p align="left"><font size="3">HRESULT ServerPort([out, retval]
long *pVal);<br>
HRESULT ServerPort([in] long newVal);</font></p>
<p><strong>Remarks:</strong></p>
<p>Get/Set IP port. Open modbus protocol use port 502 as a
default.</p>
<p align="left"><font size="3"><strong>Data Type </strong></font></p>
<p align="left"><font size="3"><strong>Long </strong></font></p>
<p align="left"><font size="4"><strong></strong></font> </p>
<p align="center"><font size="6"><strong>Methods</strong></font></p>
<p align="left"><font size="5"><strong>StartServer</strong></font></p>
<p align="left"><font size="3">TcpServer.StartServer</font></p>
<p align="left"><font size="3">HRESULT StartServer([out,retval]
VARIANT_BOOL* pbOk);</font></p>
<p><strong></strong> </p>
<p><strong>Return Value </strong></p>
<p><font size="3">True if function succeeds or False if fails.</font></p>
<p align="left"><font size="3"><strong>Remarks</strong></font></p>
<p align="left"><font size="3">After setting<strong> </strong>ServerAddress
and ServerPort , call this method to start TCP Serial port
interface. If the return value is true any client can connect
using TCP/IP network and send messages to the modbus device.</font></p>
<p align="left"><font size="3">.</font></p>
<p align="left"><font size="5"><strong>StopServer</strong></font></p>
<p align="left"><font size="3">TcpServer.StopServer</font></p>
<p align="left"><font size="3">HRESULT StopServer([out,retval]
VARIANT_BOOL* pbOk);</font></p>
<p><strong></strong> </p>
<p><strong>Return Value </strong></p>
<p><font size="3">True if function succeeds or False if fails.</font></p>
<p align="left"><font size="3"><strong>Remarks</strong></font></p>
<p align="left"><font size="3">This method stop tcp server and
disconnect any client that is using the server.</font></p>
<p align="left"><a href="Autosrv.htm"><font size="3">Modbus
Automation Server</font></a><font size="3"> , </font><a
href="index.htm"><font size="3">Home</font></a><font size="3"> </font></p>
<p align="left"><font size="3"><strong></strong></font> </p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -