DatagramSocket s = null;
try{
s = new DatagramSocket ();
byte [] buffer;
buffer = content.getBytes ();//content为要发的内容String类
if(buffer.length>200){out.println("系统错误,buffer过长!<a href='history.go(-1)'>返回</a>");}
InetAddress ia = InetAddress.getByName(clientIP);//clientIP为String类IP地址
DatagramPacket dgp = new DatagramPacket (buffer,buffer.length,ia,10000);
s.send (dgp);
} catch (Exception e)
{
System.out.println (e.toString ());
}
finally
{
if (s != null)
s.close ();
}