`
AquariusM
  • 浏览: 147825 次
  • 性别: Icon_minigender_1
  • 来自: 南阳
社区版块
存档分类
最新评论

2010年7月29号--关于一个文件读取错误的问题

阅读更多
2010年7月29号 -- 关于Error:Error #2030:end of the file was encounted.

The socket is now connector... Error: Error #2030: 遇到文件尾。
at flash.net::Socket/readUTF() at send()

   昨天在写as3.0与java服务端socket连接时的一个错误,上网上查看一些评论和注释,最后还是英文网站给我了真正的原因解析,此错误来源于
    EOFError; An EOFError exception is thrown when you attempt to read past the end of the available data.For example,an EOFError is thrown when one of the read methods in the IDataInput interface is called and there is insufficient data to satisfy the read request.


下面是一个英文论坛网上的问题和解决办法:
    Using Action Script 3 in Flex Builder 3:
When handing a SOCKET_DATA event,I occasionally,seemingly at random,get an "Error #2030:End of file was encoutered." When calling socket.readInt().I'm confused as to want this error means,since I'm not reading a file?I'm a little unfamilier with sockets.Thanks.

2 Answers:

   when reading off a socket,that is closed,you will get:Error #2002:Operation attempted on invalid socket. end of fiel errors typically occur on any bytestreams,if you read more bytes than avaliable ... this is the case for files,sockets,etc....in the case of flash,it occurs when reading from a Socket or a ByteArray and maybe even in other cases...

   TCP/IP is package based,but emulates a stream...thus you can only read the data off the stream,that was already sent to you with TCP packages...check Socket::byteAvaliable to find out,how many bytes are currently avaliable...always keep in mind,that the data you write to the socket in one operation may arrive in mutiple packages,each very probably causing flash player to trigger socketData events...

于是我就修改我的.as文件,查看socket.byteAvaliable 然后利用   socket.readUTFBytes(socket.byteAvaliable)进行查看,结果依然是这样,说明我根本没有接收到数据。 最后在javaEye上看到一个astionscript与socket交互的教程,才发现是应该写事件的,但是我没有些;至于为什么写事件,以及事件写了以后有什么效果,仍然学习中。。。待续。。。
分享到:
评论
1 楼 caoshiyu2008 2013-08-27  
请问这个问题如何解决的?

相关推荐

    Oracle SQL高级编程(资深Oracle专家力作,OakTable团队推荐)--随书源代码

    她是OakTable的成员,同时是Expert Oracle Practices (2010年 Apress出版)一书的合著者。  RIYAJ SHAMSUDEEN 专注于性能/数据恢复/电子商务的咨询公司OraInternals的首席数据库管理员和董事长。有近20年使用...

    NOD32_ID自动获取工具_1.4绿色免费版

    修改时间: 2010年8月29日, 0:11:56 MD5: 09EA348174673CFA7F2F1715F7F2B310 SHA1: 3BA7B35FB6C7C5F089659611D051295641600F77 CRC32: 56485A24 文件MD5校验软件:http://u.115.com/file/f2cc9079c4 本人发布的软件...

    Java入门1·2·3:一个老鸟的Java学习心得.PART3(共3个)

    出版日期:2010 年3月 开本:16开 其他详细信息查看:http://www.china-pub.com/196571 编辑推荐 Java编程老鸟潜心写作,奉献高效率的Java学习心得 完全站在没有编程经验读者的角度,手把手教会读者学习Java ...

    JAVA入门1.2.3:一个老鸟的JAVA学习心得 PART1(共3个)

    出版日期:2010 年3月 开本:16开 其他详细信息查看:http://www.china-pub.com/196571 编辑推荐 Java编程老鸟潜心写作,奉献高效率的Java学习心得 完全站在没有编程经验读者的角度,手把手教会读者学习Java ...

    人力资源管理软件(完全免费)

    提供个税工具,应发金额、所得税、应发任输一个数据自动计算另外2个 灵活生成各类统计报表,可定制方案 查询非常方便,支持组合条件查询 支持员工数据导入,支持初始工资数据导入,启用非常方便(见dll目录下导入...

Global site tag (gtag.js) - Google Analytics