资源简介
源码支持PLC200/300/400与上位机进行通讯,采用S7协议

代码片段和文件信息
/*
Part of multithreaded network servers. The servers MAIN thread is started by
the main program. It starts in turn the ACCEPTER thread which accepts a
connection and passes the file descriptor to the MAIN thread. The server MAIN
thread starts a PORT SERVER thread to handle the connection. Thus the
PORT SERVER thread is NOT a child of ACCEPTER but a brother and SIGCHILD goes
to the server MAIN. If it would go to ACCEPTER which is blocked in the
accept() system call we would get “process interrupted in system call“ and
that‘s it. Maybe its different with pthread library..?
Part of Libnodave a free communication libray for Siemens S7 300/400.
(C) Thomas Hergenhahn (thomas.hergenhahn@web.de) 2001..2005.
LIBNDAVE is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 or (at your option)
any later version.
LIBNODAVE is distributed in the hope that it will be useful
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this; see the file COPYING. If not write to
the Free Software Foundation 675 Mass Ave Cambridge MA 02139 USA.
*/
typedef struct {
int fd;
int port;
} accepter_info;
void *accepter(void *arg)
{
int s;
int newfd pipefd;
socklen_t addrlen;
struct sockaddr_in addr;
int i;
int opt;
usleep(10000);
pipefd = ((accepter_info *) arg)->fd;
LOG2(ThisModule “Accepter : My pipe is:%d\n“ pipefd);
FLUSH;
s = socket(AF_INET SOCK_STREAM 0);
if (errno != 0) {
LOG2(ThisModule “Accepter : socket %s\n“ strerror(errno));
FLUSH;
}
LOG2(ThisModule “Accepter : port %d\n“
((accepter_info *) arg)->port);
addr.sin_family = AF_INET;
addr.sin_port =htons(((accepter_info *) arg)->port);
// (((((accepter_info *) arg)->port) & 0xff) << 8) |
// (((((accepter_info *) arg)->port) & 0xff00) >> 8);
// LOG2(ThisModule“Accepter : port %d\n“addr.sin_port);
inet_aton(“0.0.0.0“ &addr.sin_addr);
opt = 1;
i = setsockopt(s SOL_SOCKET SO_REUSEADDR &opt 4);
LOG2(ThisModule “Accepter : setsockopt %s\n“ strerror(errno));
addrlen = sizeof(addr);
bind(s (struct sockaddr *) & addr addrlen);
LOG2(ThisModule “Accepter : bind %s\n“ strerror(errno));
listen(s 1);
LOG2(ThisModule “Accepter : listen: %s\n“ strerror(errno));
while (1) {
addrlen = sizeof(addr);
LOG1(ThisModule “Accepter : before accept\n“);
newfd = (accept(s (struct sockaddr *) & addr &addrlen));
LOG2(ThisModule “Accepter: after accept. New fd:%d\n“ newfd);
FLUSH;
LOG3(ThisModule “Accepter: PID(%d) client:%s\n“ getpid()
inet_ntoa(addr.sin_addr));
FLUSH;
write(pipefd &newfd sizeof(newfd));
}
shutdown(s 2);
LO
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3127 2018-02-02 19:02 libnodave-0.8.5(初始稿)\accepter.c
文件 4935 2018-02-02 19:02 libnodave-0.8.5(初始稿)\benchmark.c
文件 411 2018-02-02 19:02 libnodave-0.8.5(初始稿)\buildall
文件 7226 2018-02-02 19:02 libnodave-0.8.5(初始稿)\ChangeLog
文件 50036 2018-02-02 19:02 libnodave-0.8.5(初始稿)\contributions\LotTrack-103.zip
文件 17445 2018-02-02 19:02 libnodave-0.8.5(初始稿)\contributions\PowerBasic\Dave.bas
文件 76288 2018-02-02 19:02 libnodave-0.8.5(初始稿)\contributions\PowerBasic\Dave.exe
文件 35834 2018-02-02 19:02 libnodave-0.8.5(初始稿)\contributions\PowerBasic\Dave.inc
文件 52 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Delphi\Editor.ddp
文件 5747 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Delphi\Editor.dfm
文件 5392 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Delphi\Editor.pas
文件 52 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Delphi\Main.ddp
文件 9126 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Delphi\Main.dfm
文件 9756 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Delphi\Main.pas
文件 374 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Delphi\NoDaveDemo.cfg
文件 2117 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Delphi\NoDaveDemo.dof
文件 1402 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Delphi\NoDaveDemo.dpr
文件 766 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Delphi\NoDaveDemo.ico
文件 1680 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Delphi\NoDaveDemo.res
文件 2569 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Delphi\SZLView.dfm
文件 2879 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Delphi\SZLView.pas
文件 6625 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Lazarus\Editor.lfm
文件 6793 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Lazarus\Editor.lrs
文件 5526 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Lazarus\Editor.pas
文件 7809 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Lazarus\Main.lfm
文件 8357 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Lazarus\Main.lrs
文件 9352 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Lazarus\Main.pas
文件 10542 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Lazarus\NoDaveDemo.lpi
文件 323 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\Lazarus\NoDaveDemo.lpr
文件 606720 2018-02-02 19:02 libnodave-0.8.5(初始稿)\DelphiComponent\Demo\NoDaveDemo.exe
............此处省略325个文件信息
- 上一篇:高等电磁场理论--科大
- 下一篇:bootstrap-文件上传模板
相关资源
-
kingba
se-jdbc-v8.zip - springboot2+activiti 7 -- maven工程依赖配置
- activitiDemo.rar
- PLC1200MODBUS TCP 程序
- FindEigen.cmake
- 针对MPLAB® X IDE使用PICKit™ 3在线调
- halcon基本算法(1页)
- R语言数据挖掘 教程.docx
- powerdesigner 15.1 license key
- powerdesigner15.0的注册码license key
- 专业版 Visio 工具cn_visio_professional_20
- riscv-spec手册
- AutoCAD系统变量一览表.doc
- 《深入剖析Tomcat中文版+英文版》.ra
- tomcat 8.0 32位 绿色版
- tomcat7 32位
- TCP通讯(接收.vi)
- 在LabVIEW 中利用TCPIP协议实现网络通信
- 信息素S型更新的耦合ACO算法及其应用
- RT_7_lite_精简列表.docx
- 可以在XE下使用的DosCommand,捕获控制
- excelApi 和安装工具
- GBT 20438.5-2017(IEC 61508-5-2010) 电气 电
- cmd.exe
- 解决检索 COM 类工厂中 CLSID 为 {96749
- Adobe cc 2018 全套破解版 ps pr等
- Bc衰变中的D波衰减器ηc211D2,ψ
- IDEFixPack2007Reg43
- ArcGIS Server 10.4.x 系列 授权文件
- UsbTrace v2.8.0.80 64位和32位破解版
评论
共有 条评论