newlisp读取数据超时功能
来源:互联网 发布:java超市商品管理系统 编辑:程序博客网 时间:2024/05/21 22:33
newlisp没有提供读取socket数据超时返回的功能。
自己实现了一个:
;; socket.lsp(context 'socket);; return the number of bytes which are ready to read;; throw error if connection is closed(define (net-peek-ex s) (unless (net-peek s) (throw-error "connection is closed")));; read specified size of data from connection in specified milliseconds;; s means socket;; timeout means waiting for milliseconds;; return the receivied data;; return () if timeout(define (read-data s timeout number) (let ((t (time-of-day)) (r 0)) (catch (while true (begin (sleep 1) (set 'r (net-peek-ex s)) (if (> r 0) (throw r)) (if (> (- (time-of-day) t) timeout) (throw -1)) )) 'q) (if (!= -1 q)(begin (net-receive s buffer (min q number)) buffer)'())))(define (test) ;;(set 's (net-connect "localhost" 7777)) (set 's (net-connect "www.baidu.com" 80)) (let (x (read-data s 50 10 buff)) (if x (println x) (println "nil:" x)) ))
- newlisp读取数据超时功能
- 用newLISP读取Hive的元数据
- store读取数据超时解决方案
- newLISP数据拟合
- newLISP数据引用
- newlisp读取文件性能测试
- newLISP 将数据存入mysql datetime字段
- 从socket中读取数据时使用超时
- 从socket中读取数据时使用超时
- 一段mongodb服务器读取数据超时的故事
- 如何在Mongodb中实现数据超时自动删除功能?
- Socket的读取超时与连接超时
- HttpClient设置请求超时和读取超时
- HttpClient连接超时及读取超时
- HttpClient连接超时及读取超时
- HttpClient连接超时及读取超时
- 通讯录包含保存文本数据和读取文本数据功能
- 从socket中读取数据时使用超时 阅读次数5628
- Mahout下个性化推荐引擎Taste介绍
- WINCE双缓冲绘图
- Java之常量池
- UITextField
- Apache Mahout中的机器学习算法集
- newlisp读取数据超时功能
- opencv之2D点集最小外包矩形和圆形
- 软件设计模式系列之一 什么是设计模式(一)
- eclipse快捷键
- 【并查集+字典树】poj2513 Colored Sticks
- VSDebug、Ollydbg、WinDbg字符串条件断点设置方法
- 对特定文件夹下的图像序列文件读写
- 问题一百零二:素数的判定
- Jquery焦点图/幻灯片效果 插件 KinSlideshow