摘要: 1.socket 服务端开启格式:socket –server command ?options? port-server :表明开启的是服务器端port:端口command:当有客户端来连接的时候,执行这个过程,这个过程有三个参数channel:给新客户端的通道address:提供给客户端连接的 ip 地址port:端口2.客户端连接服务器端格式:socket ?options? host porthost port :客户端连接的服务器 ip和端口3.fileevent定义了一个句柄,满足条件时执行格式:fileevent channelId readable? script?fileev 阅读全文
posted @ 2010-12-08 23:18 greencolor 阅读(1922) 评论(0) 推荐(0) 编辑
摘要: 面向连接的Socket实例   代码实例中的服务器通过socket连接向客户端发送字符串"Hello, you are connected!"。只要在服务器上运行该服务器软件,在客户端运行客户软件,客户端就会收到该字符串。   该服务器软件代码如下: #include stdio.h #include stdlib.h #include errno.h #include string.h #include sys/types.h #include netinet/in.h #include sys/socket.h #include sys/wait.h #de 阅读全文
posted @ 2010-12-08 22:16 greencolor 阅读(378) 评论(0) 推荐(0) 编辑