如何访问局域网上的文件

var
  NetSource : TNetResource;    file://连接服务器结构
  dwResult:DWORD;               file://连接文件服务器的返回值

procedure ConnectServer;
begin
    g_bFlag:=True;
    NetSource.dwType:= RESOURCETYPE_ANY;
    NetSource.lpLocalName:='';
    NetSource.lpRemoteName:=PAnsiChar('//'+g_sServerIp);
    NetSource.lpProvider:='';
    dwResult:=WnetAddConnection2(NetSource,PAnsiChar(g_sServerPassWord),PAnsiChar(g_sServerUserName),CONNECT_UPDATE_PROFILE);
    if dwResult<>0 then
    begin
        MessageDlg('连接文件服务器失败!'#13#10'请重新设置!',mtWarning,[mbOk],0);
        g_bFlag:=False;
    end;
end;

procedure DisconnectServer;
begin
    if g_bFlag then
        WNetCancelConnection2(PAnsiChar('//'+g_sServerIp), CONNECT_UPDATE_PROFILE, True);
end;

要从局域网访问node-red,需要遵循以下步骤: 1. 确定本地IP地址:在命令提示符或终端中输入`ipconfig`(Windows系统)或`ifconfig`(Linux或MacOS系统)来查看本地IP地址。 2. 在node-red的设置文件中启用远程访问选项:在node-red的工作目录中找到`settings.js`文件,在其中寻找以下行: ``` // The following property can be used to enable HTTPS (no SSL) on the editor //server. See http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener // for details on its contents. The cert and key fields can either contain //the content of the certificate or the path to the file. Note that this //HTTPS settings are ignored if running the server through an existing //HTTPS proxy such as nginx or HAProxy. //https: { // cert: "/path/to/cert.pem", // key: "/path/to/key.pem" //}, ``` 将其中的`https:`选项取消注释并修改如下: ``` https: { key: require("fs").readFileSync("client-key.pem"), cert: require("fs").readFileSync("client-cert.pem") }, ``` (其中的`client-key.pem`和`client-cert.pem`是你的服务器证书和密钥文件的名称)。 3. 开启node-red服务:在命令提示符或终端中输入以下命令以启动node-red服务: ``` node-red ``` 4. 访问node-red:在浏览器地址栏中输入`http://本地IP地址:1880`(其中“本地IP地址”是第一步中查看到的地址),然后按下回车键即可。 以上就是从局域网访问node-red的步骤。需要注意的是,如果你的路由器启用了防火墙功能,可能需要手动设置允许访问node-red的端口号(默认为1880)。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值