⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 在j2me中实现基于udp协议通讯程序.htm

📁 这是我整理的关于j2me飞机游戏制作材料,对入门有很大的帮助的
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0038)http://www.yesky.com/355/1880855.shtml -->
<HTML lang=zh-CN xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>在J2ME中实现基于UDP协议通讯程序</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META http-equiv=Content-Language content=zh-CN>
<META content=all name=robots>
<META content="index, follow" name=googlebot>
<META content="MSHTML 6.00.2900.2802" name=GENERATOR>
<META content="天极Yesky | 全球中文IT第一门户" name=author>
<META content="天极Yesky | 全球中文IT第一门户" name=Copyright>
<META content=硬件,软件,数码,游戏,e时代,下载,社区,评测,笔记本; name=keywords><LINK media=all 
href="在J2ME中实现基于UDP协议通讯程序.files/yesky-content-cs.css" type=text/css 
rel=stylesheet></HEAD>
<BODY>
<SCRIPT language=JavaScript>
function sendemail(){ 
OpenWindow = window.open('http://other.chinabyte.com/chinabyte/qin/sendemail-new.shtm?url=http://www.yesky.com/355/1880855.shtml&title=在J2ME中实现基于UDP协议通讯程序&channel=324','emailwin','toolbar=no,location=no,scrollbars=no,menubar=no,width=462,height=450')
}</SCRIPT>
<!--头部-->
<DIV class=hidden>yesky内容</DIV>
<STYLE type=text/css>INPUT#searchzz {
	FONT-SIZE: 12px; WIDTH: 76px; FONT-FAMILY: "宋体"
}
INPUT#search_btn {
	FONT-SIZE: 12px; WIDTH: 60px; FONT-FAMILY: "宋体"
}
A.headblack-s-l:link {
	FONT-SIZE: 12px; COLOR: #000000; LINE-HEIGHT: 19px; FONT-FAMILY: "Arial", "Helvetica", "sans-serif"; TEXT-DECORATION: none
}
A.headblack-s-l:visited {
	FONT-SIZE: 12px; COLOR: #000000; LINE-HEIGHT: 19px; FONT-FAMILY: "Arial", "Helvetica", "sans-serif"; TEXT-DECORATION: none
}
A.headblack-s-l:active {
	FONT-SIZE: 12px; COLOR: #000000; LINE-HEIGHT: 19px; FONT-FAMILY: "Arial", "Helvetica", "sans-serif"; TEXT-DECORATION: underline
}
A.headblack-s-l:hover {
	FONT-SIZE: 12px; COLOR: #000000; LINE-HEIGHT: 19px; FONT-FAMILY: "Arial", "Helvetica", "sans-serif"; TEXT-DECORATION: underline
}
.rightmenucontent_top {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FLOAT: left; MARGIN-BOTTOM: 5px; PADDING-BOTTOM: 0px; WIDTH: 148px; COLOR: #065b06; PADDING-TOP: 2px; HEIGHT: 18px; TEXT-ALIGN: center
}
.rightmenucontent {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FLOAT: left; PADDING-BOTTOM: 0px; WIDTH: 148px; COLOR: #065b06; PADDING-TOP: 2px; HEIGHT: 18px; TEXT-ALIGN: center
}
.rightarea {
	BORDER-RIGHT: #cc4509 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: #cc4509 1px solid; PADDING-LEFT: 3px; BACKGROUND: #fcffe8; FLOAT: left; PADDING-BOTTOM: 3px; BORDER-LEFT: #cc4509 1px solid; WIDTH: 95px; PADDING-TOP: 3px; BORDER-BOTTOM: #cc4509 1px solid
}
.rightarea_right {
	BORDER-RIGHT: #cc4509 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: #cc4509 1px solid; PADDING-LEFT: 3px; BACKGROUND: #fcffe8; FLOAT: right; PADDING-BOTTOM: 3px; BORDER-LEFT: #cc4509 1px solid; WIDTH: 30px; PADDING-TOP: 3px; BORDER-BOTTOM: #cc4509 1px solid
}
DIV#eqy1 {
	PADDING-RIGHT: 3px; BORDER-TOP: #a9abab 1px solid; PADDING-LEFT: 2px; FONT-WEIGHT: bold; BACKGROUND: #e8fdef; FLOAT: left; PADDING-BOTTOM: 0px; COLOR: #309045; PADDING-TOP: 1px; HEIGHT: 19px
}
</STYLE>
<!--套住整个头子994的大表格-->
<DIV class=allhead><!--套住左边776的最大的表格-->
<DIV class=lzfleft>
<DIV id=newheader><!--logo-->
<DIV>
<DIV id=newlogo><A href="http://www.yesky.com/"><IMG title=天极Yesky alt=天极Yesky 
src="在J2ME中实现基于UDP协议通讯程序.files/yeskylogo.gif" width=116 
border=0></A></DIV></DIV><!--中间广告-->
<DIV id=middlead><SPAN id=ad1></SPAN></DIV><!--中间广告结束--><!--右部菜单-->
<DIV id=rightmenu>
<DIV class=rightmenucontent_top>
<FORM name=searchform action=http://search.chinabyte.com/search 
method=get><INPUT id=searchzz onmouseover=this.focus() onfocus=this.select() 
size=11 name=q><INPUT type=hidden value=GB2312 name=encoding><INPUT type=hidden 
value=connect name=dir> <INPUT type=hidden value=20002 name=cid><INPUT id=search_btn type=submit value=天极搜索> </FORM></DIV>
<DIV class=headclear></DIV>
<DIV class=rightarea><A class=headblack-s href="http://bj.yesky.com/">北京</A> <A 
class=headblack-s href="http://sh.yesky.com/">上海</A> <A class=headblack-s 
href="http://gd.yesky.com/">广东</A><BR><A class=headblack-s 
href="http://cq.yesky.com/">重庆</A> <A class=headblack-s 
href="http://cd.yesky.com/">成都</A> <A class=headblack-s 
href="http://sy.yesky.com/">沈阳</A> </DIV>
<DIV class=rightarea_right><A class=headblack-s-l 
href="http://my.yesky.com/">用户<BR>登录</A></DIV>
<DIV class=rightmenucontent><A class=headgreen 
href="http://www.chinabyte.com/">Chinabyte.com</A><SPAN 
style="FONT-SIZE: 9px">|</SPAN><A class=headblue 
href="http://www.techtarget.com.cn/">Techtarget.com.cn</A></DIV>
<DIV class=clear></DIV></DIV></DIV><!--头部结束-->
<DIV class=headclear></DIV><!--第一栏导航-->
<DIV class=box>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/index-nav06.gif" 
border=0></DIV>
<DIV id=ityj><A class=headblack-s href="http://www.chinabyte.com/"><SPAN 
style="COLOR: #07346e">IT业界</SPAN></A></DIV>
<DIV class=headbg1><A class=headblack-s 
href="http://news.chinabyte.com/">新闻</A>&nbsp;<A class=headblack-s 
href="http://column.chinabyte.com/">评论</A>&nbsp;<A class=headblack-s 
href="http://telecom.chinabyte.com/">通信</A>&nbsp;<A class=headblack-s 
href="http://net.chinabyte.com/">互联网</A>&nbsp;<A class=headblack 
href="http://columnist.chinabyte.com/">专栏</A>&nbsp;<A class=headblack 
href="http://my.chinabyte.com/">CB博客</A></DIV>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/index-nav07.gif" 
border=0></DIV>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/index-nav08.gif" 
border=0></DIV>
<DIV id=eqy><A class=headblack-s href="http://e.chinabyte.com/"><SPAN 
style="COLOR: #309045">E企业</SPAN></A></DIV>
<DIV class=headbg1><A class=headblack-s 
href="http://solution.chinabyte.com/">解决方案</A>&nbsp;<A class=headblack-s 
href="http://biz.chinabyte.com/">商用系统</A>&nbsp;<A class=headblack-s 
href="http://biz.chinabyte.com/cbfwq">服务器</A>&nbsp;<A class=headblack-s 
href="http://telecom.chinabyte.com/NetCom/218449874989875200/index.shtml">交换</A>&nbsp;<A 
class=headblack-s href="http://data.chinabyte.com/">数据调查</A></DIV>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/index-nav07.gif" 
border=0></DIV>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/index-nav09.gif" 
border=0></DIV>
<DIV id=itzj><A class=headblack-s href="http://www.techtarget.com.cn/"><SPAN 
style="COLOR: #478e9a">IT专家</SPAN></A></DIV>
<DIV class=headbg1><A class=headblack-s 
href="http://searchdatabase.techtarget.com.cn/">数据库</A>&nbsp;</DIV>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/index-nav07.gif" 
border=0></DIV>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/index-nav08.gif" 
border=0></DIV>
<DIV id=eqy1><A class=headblack-s href="http://com.chinabyte.com/"><SPAN 
style="COLOR: #309045">企业博客</SPAN></A></DIV>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/zhy0728.gif" 
border=0></DIV></DIV><!--第三栏导航-->
<DIV class=box>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/index-nav15.gif" 
border=0></DIV>
<DIV id=itjs><A class=headblack-s href="http://t.yesky.com/"><SPAN 
style="COLOR: #0051c0">IT技术</SPAN></A></DIV>
<DIV class=headbg3><A class=headblack href="http://soft.yesky.com/">软件</A> <A 
class=headenglish href="http://soft.yesky.com/os/win/">Windows</A>&nbsp;<A 
class=headblack-s href="http://design.yesky.com/">设计</A>&nbsp;<A 
class=headenglish 
href="http://design.yesky.com/photoshop/">Photoshop</A>&nbsp;<A 
class=headblack-s href="http://dev.yesky.com/">开发</A>&nbsp;<A class=headenglish 
href="http://dev.yesky.com/msdn/">MSDN</A>&nbsp;<A class=headblack-s 
href="http://soft.yesky.com/security/">安全</A>&nbsp;<A class=headblack-s 
href="http://soft.yesky.com/office/">办公</A>&nbsp;<A class=headblack-s 
href="http://edu.yesky.com/">认证</A>&nbsp;<A class=headblack-s 
href="http://bbs.yesky.com/">论坛</A></DIV>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/index-nav16.gif" 
border=0></DIV>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/index-nav17.gif" 
border=0></DIV>
<DIV id=szsh><A class=headblack-s href="http://i.yesky.com/"><SPAN 
style="COLOR: #d70418">数字生活</SPAN></A></DIV>
<DIV class=headbg3><A class=headblack href="http://e.yesky.com/">e时代</A>&nbsp;<A 
class=headblack href="http://game.yesky.com/">游戏</A>&nbsp;<A class=headblack-s 
href="http://comic.yesky.com/">动漫</A>&nbsp;<A class=headblack 
href="http://pic.yesky.com/">图片</A>&nbsp;<A class=headblack-s 
href="http://desktop.yesky.com/">壁纸</A>&nbsp;<A class=headblack 
href="http://my.yesky.com/">社区</A>&nbsp;<A class=headblack-s 
href="http://hot.yesky.com/">网摘</A>&nbsp;<A class=headblack-s 
href="http://blog.yesky.com/">博客</A>&nbsp;<A class=headblack 
href="http://www.mydown.com/">下载</A></DIV>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/index-nav16.gif" 
border=0></DIV></DIV><!--第二栏导航-->
<DIV class=box>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/index-nav19.gif" 
border=0></DIV>
<DIV id=xfdh><A class=headblack-s href="http://cseek.yesky.com/"><SPAN 
style="COLOR: #f04400">消费导购</SPAN></A></DIV>
<DIV class=headbg2>&nbsp;<A class=headblack 
href="http://product.yesky.com/">产品库</A>&nbsp;<A class=headblack 
href="http://cseek.yesky.com/">商情</A>&nbsp;<A class=headblack 
href="http://mobile.yesky.com/">手机</A>&nbsp;<A class=headblack 
href="http://digital.yesky.com/">数码:</A><A class=headblack-s 
href="http://mp3.yesky.com/"><SPAN class=fontsize>MP3</SPAN>随身听</A>&nbsp;<A 
class=headblack-s href="http://dc.yesky.com/">数码相机</A>&nbsp;<A class=headblack-s 
href="http://dv.yesky.com/">摄像机</A>&nbsp;<A class=headblack 
href="http://notebook.yesky.com/">笔记本</A>&nbsp;<A class=headblack 
href="http://pc.yesky.com/">台式机</A>&nbsp;<A class=headblack 
href="http://diy.yesky.com/">DIY硬件</A>&nbsp;<A class=headblack 
href="http://oa.yesky.com/">办公外设</A>&nbsp;<A class=headblack 
href="http://net.yesky.com/">网络设备</A>&nbsp;<A class=headblack 
href="http://dh.yesky.com/">数字家庭</A>&nbsp;<A class=headblack 
href="http://lab.yesky.com/">天极评测</A>&nbsp;</DIV>
<DIV class=left><IMG src="在J2ME中实现基于UDP协议通讯程序.files/index-nav12.gif" 
border=0></DIV></DIV><!--套住左边776的最大的表格结束--></DIV><!--右侧小广告开始-->
<DIV class=rightbotton><SPAN id=ad9></SPAN></DIV><!--套住整个983的最大的表格结束--></DIV>
<DIV class=clear1></DIV><!--笔记本导航条-->
<DIV class=newbox>
<DIV class=newbgpic>
<DIV class=left>您现在的位置:<A href="http://www.yesky.com/"> Yesky</A>&gt;<A 
href="http://soft.yesky.com/"> 软件</A>&gt;<A href="http://dev.yesky.com/"> 
开发者网络</A> </DIV>
<DIV class=right>
<DIV class=space1><SPAN id=ad3></SPAN></DIV></DIV></DIV></DIV>
<DIV class=clear1></DIV><!--结束-->
<DIV class=clear1></DIV><!--文章内容区-->
<DIV class=newbox>
<DIV class=newleft>
<DIV class=newleft1>
<DIV class=newsmallbox>在J2ME中实现基于UDP协议通讯程序 </DIV>
<DIV class=clear1></DIV>
<DIV class=newsmall1box>
<DIV class=newtitle1>作者: mingjava </DIV>
<DIV class=newtitle2>出处: J2ME开发网 </DIV>
<DIV class=newtitle3>责任编辑: 方舟 </DIV>
<DIV class=newtitle4>[ 2004-11-26 17:46 ]</DIV></DIV>
<DIV class=clear1></DIV>
<DIV class=space2><SPAN id=ad5></SPAN></DIV><BR>
<DIV class=newmiddlebox style="OVERFLOW: hidden">
<DIV class=guanggao><SPAN id=ad4></SPAN></DIV>
<DIV class=guanggao><SPAN 
id=contentAdv></SPAN></DIV>  在GCF中提供了DatagramConnection和Datagram两个接口,借助他们我们可以在J2ME中基于<A 
class=bluekey href="http://www.yesky.com/key/1843/591843.html" 
target=_blank>UDP</A>协议开发联网应用程序。在MIDP2.0中,添加了UDPDatagramConnection这个接口,他扩展了DatagramConnection并添加了两个方法getLocalAddress()和getLocalPort()。我们知道UDP服务是不可靠的,如果你希望开发更可靠的联网应用的话可以采用SocketConnection,因为TCP服务是面向连接且可靠的。我们还必须清楚地一点是以上所说的各种连接方式都不是MIDP规范中规定必须实现的。因此在使用之前请参考特定设备的开发文档。MIDP中只有Http连接是必须支持的。 
<BR><BR>  同样,我们要获得DatagramConnection的话,必须通过Connector的open方法,其中的<A class=bluekey 
href="http://www.yesky.com/key/3809/593809.html" target=_blank>URL</A>应该满足如下的形式。 

<OL>
  <LI>datagram://localhost:5555 这样的话表示建立了一个客户端模式的连接。在指定ip:localhost和指定端口:5555 
  <LI>datagram://:5555 这样建立的是一个服务器端模式的连接,在本地的5555端口。</LI></OL>
<P>  <A class=bluekey href="http://www.yesky.com/key/4060/399060.html" 
target=_blank>建立连接</A>后,我们可以通过DatagramConnection的newDatagram()方法构造一个Datagram,然后调用DatagramConnection的send()方法。这样数据报将会发送到指定的接受方。例如你可以构建这个一个负责发送数据的Sender类。</P>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#e6e4dd border=1>
  <TBODY>
  <TR>
    <TD>
      <P>package com.<A class=bluekey 
      href="http://www.yesky.com/key/3767/593767.html" 
      target=_blank>siemens</A>.datagramtest;</P>
      <P>import javax.microedition.io.Datagram;<BR>import 
      javax.microedition.io.DatagramConnection;</P>
      <P>public class Sender extends Thread<BR>{</P>
      <P>  private DatagramConnection dc;</P>
      <P>  private String <A class=bluekey 
      href="http://www.yesky.com/key/318/595318.html" 
      target=_blank>address</A>;</P>
      <P>  private String message;</P>
      <P>  public Sender(DatagramConnection dc)<BR>  {<BR>    this.dc = 
      dc;<BR>    start();<BR>  }</P>
      <P>  public synchronized void send(String addr, String msg)<BR>  {<BR>    
      address = addr;<BR>    message = msg;<BR>    notify();<BR>  }</P>
      <P>  public synchronized void run()<BR>  {</P>
      <P>    while (true)<BR>    {</P>
      <P>      // If no client to deal, wait until one connects<BR>      if 
      (message == null)<BR>      {<BR>        try<BR>        {<BR>          
      wait();<BR>        } catch (InterruptedException e)<BR>        
      {<BR>        }<BR>      }</P>
      <P>      try<BR>      {<BR>        byte[] bytes = 
      message.getBytes();<BR>        Datagram dg = null;<BR>        // Are we a 
      sender thread for the client ? If so then there's<BR>        // no address 
      parameter<BR>        if (address == null)<BR>        {<BR>          dg = 
      dc.newDatagram(bytes, bytes.length);<BR>        } else<BR>        
      {<BR>          dg = dc.newDatagram(bytes, bytes.length, 
      address);<BR>          System.out.println(address);<BR>        
      }<BR>        dc.send(dg);<BR>      } catch (Exception ioe)<BR>      
      {<BR>        ioe.printStackTrace();<BR>      }</P>
      <P>      // Completed client handling, return handler to pool and<BR>      
      // mark for wait<BR>      message = null;<BR>    }<BR>  }</P>
      <P>}</P></TD></TR></TBODY></TABLE>
<P>  注意联网的时候我们应该在另外一个线程中而不是在主线程中。 <BR><BR></P>
<DIV class=right>共3页。 <A class=page 
href="http://www.yesky.com/355/1880855.shtml" target=_self><FONT 
color=#666666><B>1</B></FONT></A> <A class=page 
href="http://www.yesky.com/355/1880855_1.shtml" target=_self><B>2</B></A> <A 
class=page href="http://www.yesky.com/355/1880855_2.shtml" 
target=_self><B>3</B></A> <A class=page 
href="http://www.yesky.com/355/1880855_1.shtml" target=_self><FONT 
face=Webdings>8</FONT></A> <A class=page 
href="http://www.yesky.com/355/1880855_2.shtml" target=_self><FONT 
face=Webdings>:</FONT></A></DIV></DIV>
<DIV class=clear1></DIV></DIV><!--结束-->
<DIV class=clear1></DIV>
<DIV class=newleft1>
<DIV class=space2><SPAN id=ad7></SPAN></DIV></DIV><!--文章评论区-->
<SCRIPT language=JavaScript>
<!--
var aid = 1880855;
var channelid = 324;

//-->
</SCRIPT>

<DIV class=newxiangguan>
<DIV class=newxiangguanmenu><A href="http://my.yesky.com/" 
target=_blank>天极社区</A>邀请您:<A class=red-s href="http://blog.yesky.com/" 
target=_blank>写博客</A>&nbsp;<A class=red-s href="http://photo.yesky.com/" 
target=_blank>上传相片</A>&nbsp;<A class=red-s href="http://bbs.yesky.com/" 
target=_blank>论坛聊天</A>&nbsp;<A class=red-s href="http://bbs.yesky.com/" 
target=_blank>订阅电子杂志</A>&nbsp;<A class=red-s 
href="http://www.yeecai.com/mobileant/tjadd/tjload.html" 
target=_blank>彩信蚂蚁</A>&nbsp;<A class=red-s 
href="http://hot.yesky.com/">推荐网摘</A>&nbsp;<A class=red-s 
href="http://training.yesky.com/">IT培训</A>&nbsp;<A class=red-s 
href="javascript:sendemail()" target=_self>对此感兴趣</A>&nbsp;<A 
title="推荐到天极网摘 http://hot.yesky.com [鼠标划选本文摘要,然后点击本图片]" 
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(yesky=window.open('http://hot.yesky.com/dp.aspx?t='+escape(d.title)+'&amp;u='+escape(d.location.href)+'&amp;c='+escape(t)+'&amp;st=2','yesky','scrollbars=no,width=400,height=480,left=75,top=20,status=no,resizable=yes'));yesky.focus();" 
target=_self><IMG src="在J2ME中实现基于UDP协议通讯程序.files/souchang1.gif" border=0></A> 
</DIV></DIV>
<DIV class=pinlunbox>
<DIV class=pinlunguan3><SPAN id=commentsSpanText>
<SCRIPT language=JavaScript>
<!--
function getTagId(tName) {
	tName = tName.replace(/(^[\s ]*)|([\s ]*$)/g, "");
	var tagid = 0;
	for(var ti = 0; ti < tName.length; ti++) {
		tagid += tName.charCodeAt(ti);
	}
	return tagid;
}
function UrlEncode(str){
   var i,temp,p,q;
   var result="";
   str = str.replace(/(^[\s ]*)|([\s ]*$)/g, "");
   for(i=0;i<str.length;i++){
      temp = str.charCodeAt(i);
      if(temp>=0x4e00){
         execScript("ascCode=hex(asc(\""+str.charAt(i)+"\"))", "vbscript");
         result+=ascCode.replace(/(.{2})/g, "%$1");
      }else{
         result+=escape(str.charAt(i));
      }
   }
   return result;
}
if(typeof(channelid) == "undefined") channelid = 0;

if(typeof(aid) != "undefined") {
	if(typeof(tagname) == "string" && tagname.length > 0) {
		document.write(" <a href=\"http://comments.yesky.com/t/"+UrlEncode(tagname)+"/6," + channelid + "/" + aid + ".shtml\" class=\"red-s\"  target=\"_blank\">查看主题:<font color=\"#FF0000\">" + tagname + "</font>的内容</a>");
	} else {
		document.write(" <a href=\"http://comments.yesky.com/a/6," + channelid + "/" + aid + ".shtml\" class=\"red-s\"  target=\"_blank\">查看所有内容</a>");
	}
}
//-->
</SCRIPT>
</SPAN>
<SCRIPT language=JavaScript>
function showCommentsSpan() {
	if(typeof(latest_comments_poster) == "object" && latest_comments_poster.length && latest_comments_poster.length > 0) {
		var re = /(\[s(\d{1,2})\])/ig;
		var str = "<div class=\"wzplcontent\">";
		str += "本文最新主题 共(<span class=\"fontcolor\">"+ latest_comments_num +"</span>)";
		str += "条&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;<a href=\"http://comments.yesky.com/a/6," + channelid + "/" + aid + ".shtml\"><span style=\"text-decoration:underline;\">查看本文所有评论</span></a>&lt;&lt;";
		if(typeof(tagname) == "string" && tagname.length > 0) {
			str += "&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;<a href=\"http://comments.yesky.com/t/" + UrlEncode(tagname) + "/6," + channelid + "/" + aid + ".shtml\" target=\"_blank\" class=\"red-s\"><b>查看主题:</b><font color=\"#FF0000\">" + tagname + "</font>所有主题</a> &lt;&lt; ";
		} else {
			str += " &gt;&gt; &gt;&gt; &gt;&gt; <a href=\"http://comments.yesky.com/a/6," + channelid + "/" + aid + ".shtml\" target=\"_blank\" class=\"red-s\">查看该文章所有相关主题</a> &lt;&lt; &lt;&lt; &lt;&lt; ";
		}
		str += "</div>";

		var hasVisits = typeof(latest_comments_visits) == "object" && latest_comments_visits.length > 0;
		 var hasTag = typeof(latest_comments_tagid) == "number" && latest_comments_tagid > 0;
		if(hasVisits) {
			str += "<table width=\"99%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\" align=\"center\" style=\"line-height: 120%\" bordercolor=\"#FFFFFF\" bordercolorlight=\"#D0CCD0\">"	+"\n"+
			" <tr bgcolor=\"#FFFFFF\">"	+"\n"+
			"    <td width=\"64%\">标题</td>"	+"\n"+
			"    <td width=\"15%\">发表时间</td>"	+"\n"+
			"    <td width=\"21%\">发表人</td>"	+"\n"+
			"</tr>"	;
			for (i = 0; i < latest_comments_poster.length && i < 10; i++) {
				str += "<tr bgcolor=\"#F6F6F6\">"	+"\n" ;//+
				//"	<td>" + latest_comments_visits[i] + "</td>"	+"\n"+
				//"	<td>" + latest_comments_replies[i] + "</td>";
				var url;
				if (hasTag) {
					url = "http://comments.yesky.com/l/" + latest_comments_id[i] + "/" + latest_comments_tagid + "/" + latest_comments_type[i] + "," + channelid + "/" + latest_comments_rfid[i] + ".shtml"
				} else {
					url = "http://comments.yesky.com/l/" + latest_comments_id[i] + "/" + 0 + "/" + latest_comments_type[i] + "," + channelid + "/" + latest_comments_rfid[i] + ".shtml"
				}
				str += "	<td><a href=\"" + url + "\" target=\"_blank\">" + latest_comments_contents[i].replace(re,"<img src=/TLimages/smile/face$2.gif border=0 align=middle> ") + "</a></td>"	+"\n"+
				"	<td><font color=\"#CC6600\">" + latest_comments_postdate[i] + "</font></td>"	+"\n"+
				"	<td nowrap=\"\" ><font color=\"#FF3300\">" + latest_comments_poster[i] + "</font></td>"	+"\n"+
				"</tr> ";
			}
			str += "</table>";
		} else {
			var hasLevel = typeof(latest_comments_level) == "object";
			str += "<div class=\"wzplcontent\">";
			str += "<ul class=\"spaceListul\">";
			for (i = 0; i < latest_comments_poster.length && i < 10; i++) {
				if(hasLevel) {
					str += "[" + latest_comments_level[i] + "楼:<span class=\"fontcolor\">";
				} else {
					str += "[ <span class=\"fontcolor\">";
				}
				str += latest_comments_poster[i];
				str += "</span>]  ";
				str += latest_comments_contents[i].replace(re,"<img src=/TLimages/smile/face$2.gif border=0 align=middle> ");
				str += "  (";
				str += latest_comments_postdate[i];
				str += "  )<br/>";
			}
			str += "</ul></div>";
		}

		commentsSpanText.innerHTML = str;
	} else {
		var str = "<div>";
		str += "目前本文还没有相关主题。立即发表主题,马上成为本文的第一个发表者!";
		str += "</div>";
		commentsSpanText.innerHTML = str;
	}
}
</SCRIPT>

<SCRIPT language=JavaScript>
<!--
if(typeof(aid) != "undefined") {
		document.write("<script language=\"JavaScript\" charset=\"gb2312\"  src=\"http://comments.yesky.com/articlereview/6/"+(aid%5000)+"/"+aid+".js\"><\/script>");

//	if(typeof(tagname) == "string" && tagname.length > 0) {
//		document.write("<script language=\"JavaScript\" charset=\"gb2312\"  src=\"http://comments.yesky.com/tagview/"+(getTagId(tagname)%5000)+"/"+getTagId(tagname)+".js\"><\/script>");
//	} else {
//		document.write("<script language=\"JavaScript\" charset=\"gb2312\"  src=\"http://comments.yesky.com/articlereview/6/"+(aid%5000)+"/"+aid+".js\"><\/script>");
//	}
 }
//-->
</SCRIPT>
</DIV>
<DIV class=pinlunguan3>
<DIV class=pinlunguan1>
<SCRIPT src="在J2ME中实现基于UDP协议通讯程序.files/uc.js" type=""></SCRIPT>
发表主题:(Html:禁止,UBB:允许) 
<FORM name=frmReviewPost action=http://comments.yesky.com/review.post.do 
method=post target=_blank><INPUT type=hidden name=tagName> <INPUT type=hidden 
name=rfid> <INPUT type=hidden value=6 name=type> <INPUT type=hidden name=cid> 
笔名:<INPUT size=17 name=userName><INPUT onclick=JavaScript:submitReviewForm(this.form) type=button value=发表主题 name=but><BR>标题:<INPUT 
size=30 name=title><BR><IMG onclick=Cbold() height=22 alt=粗体 
src="在J2ME中实现基于UDP协议通讯程序.files/bold.gif" width=23 border=0> <IMG 
onclick=Cimage() height=22 alt=图片 src="在J2ME中实现基于UDP协议通讯程序.files/image.gif" 
width=23 border=0> <IMG onclick=Cswf() height=22 alt=Flash图片 
src="在J2ME中实现基于UDP协议通讯程序.files/swf.gif" width=23 border=0> <IMG onclick=Cwmv() 
height=22 alt="Media Player视频文件" src="在J2ME中实现基于UDP协议通讯程序.files/mp.gif" width=23 
border=0> <IMG onclick=Crm() height=22 alt=realplay视频文件 
src="在J2ME中实现基于UDP协议通讯程序.files/rm.gif" width=23 border=0> <IMG onclick=Curl() 
height=22 alt=超级连接 src="在J2ME中实现基于UDP协议通讯程序.files/url1.gif" width=23 border=0> 
<IMG onclick=Cemail() height=22 alt=Email连接 
src="在J2ME中实现基于UDP协议通讯程序.files/email1.gif" width=23 border=0> <IMG 
onclick=Cdir() height=22 alt=Shockwave文件 
src="在J2ME中实现基于UDP协议通讯程序.files/Shockwave.gif" width=23 border=0> <TEXTAREA name=contents rows=4 cols=30></TEXTAREA> <BR><A 
href="javascript:addSmile('01')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face01.gif" border=0></A> <A 
href="javascript:addSmile('02')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face02.gif" border=0></A> <A 
href="javascript:addSmile('03')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face03.gif" border=0></A> <A 
href="javascript:addSmile('04')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face04.gif" border=0></A> <A 
href="javascript:addSmile('05')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face05.gif" border=0></A> <A 
href="javascript:addSmile('06')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face06.gif" border=0></A> <A 
href="javascript:addSmile('07')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face07.gif" border=0></A> <A 
href="javascript:addSmile('08')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face08.gif" border=0></A> <A 
href="javascript:addSmile('09')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face09.gif" border=0></A> <A 
href="javascript:addSmile('10')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face10.gif" border=0></A> <BR><A 
href="javascript:addSmile('11')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face11.gif" border=0></A> <A 
href="javascript:addSmile('12')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face12.gif" border=0></A> <A 
href="javascript:addSmile('13')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face13.gif" border=0></A> <A 
href="javascript:addSmile('14')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face14.gif" border=0></A> <A 
href="javascript:addSmile('15')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face15.gif" border=0></A> <A 
href="javascript:addSmile('16')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face16.gif" border=0></A> <A 
href="javascript:addSmile('17')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face17.gif" border=0></A> <A 
href="javascript:addSmile('18')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face18.gif" border=0></A> <A 
href="javascript:addSmile('19')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face19.gif" border=0></A> <A 
href="javascript:addSmile('20')" target=_self><IMG 
src="在J2ME中实现基于UDP协议通讯程序.files/face20.gif" border=0></A> 
</FORM><BR>请您注意:遵守国家有关法律、法规,尊重网上道德,承担一切因您的行为而直接或间接引起的法律责任。<BR>天极网拥有管理笔名和留言的一切权利。
<SCRIPT language=JavaScript>
<!--
function addSmile(val) {
	with (document.frmReviewPost) {
		contents.value += "[s" + val + "]";
	}
}

with(document.frmReviewPost) {
    if(typeof(comments_nickname) == "string" && comments_nickname.length > 0) {
        userName.value = comments_nickname;
    } else {
        userName.value = "天极网友";
    }
	if(typeof(aid) != "undefined") rfid.value = aid;
	if(typeof(channelid) != "undefined") cid.value = channelid;
	if(typeof(tagname) == "string" && tagname.length > 0) {
		tagName.value = tagname;
	}
}
function submitReviewForm(f) {
    with(f) {
        if(rfid.value.length > 0) {
			if(userName.value.length ==  0) {
				alert("请输入您的笔名!");
				userName.focus();
				return;
			}
			if(userName.value.length > 20) {
				alert("笔名太长,字数不成超过20!");
				userName.focus();
				return;
			}

			if (title.value.length == 0) {
				alert("请输入主题标题");
				title.focus();
				return false;
			}
			if (title.value.length  > 100) {
				alert("标题太长,字数不成超过100");
				title.focus();
				return false;
			}

			if(contents.value.length ==  0) {
				alert("请输入主题内容");
				contents.focus();
				return;
			}
			if(contents.value.length > 2000) {
				alert("内容太长,字数不成超过2000");
				contents.focus();
				return;
			}
            submit();
			contents.value = "";
        }
    }
}
//-->
</SCRIPT>
 </DIV>
<DIV class=right>
<DIV class=pinlunguan2><FONT color=#ff0000><B>各地网友会:</B></FONT><SELECT 
onchange=JavaScript:window.location=this.value> <OPTION value="" 
  selected>==请选择==</OPTION> <OPTION 
  value=http://comments.yesky.com/t/重庆/6,1633/0.shtml>重庆</OPTION> <OPTION 
  value=http://comments.yesky.com/t/北京/6,1633/0.shtml>北京</OPTION> <OPTION 
  value=http://comments.yesky.com/t/上海/6,1633/0.shtml>上海</OPTION> <OPTION 
  value=http://comments.yesky.com/t/天津/6,1633/0.shtml>天津</OPTION> <OPTION 
  value=http://comments.yesky.com/t/江西/6,1633/0.shtm>江西</OPTION> <OPTION 
  value=http://comments.yesky.com/t/湖北/6,1633/0.shtml>湖北</OPTION> <OPTION 
  value=http://comments.yesky.com/t/湖南/6,1633/0.shtml>湖南</OPTION> <OPTION 
  value=http://comments.yesky.com/t/广东/6,1633/0.shtml>广东</OPTION> <OPTION 
  value=http://comments.yesky.com/t/山西/6,1633/0.shtml>山西</OPTION> <OPTION 
  value=http://comments.yesky.com/t/陕西/6,1633/0.shtml>陕西</OPTION> <OPTION 
  value=http://comments.yesky.com/t/福建/6,1633/0.shtml>福建</OPTION> <OPTION 
  value=http://comments.yesky.com/t/河南/6,1633/0.shtml>河南</OPTION> <OPTION 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -