- UID
- 18416
- 帖子
- 1620
- 积分
- 53643
- 阅读权限
- 90
- 注册时间
- 2006-4-27
- 最后登录
- 2015-6-16
- 在线时间
- 15104 小时
|
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="java.io.*"%>
<%@ page import="java.net.*"%>
<%
String customer=request.getParameter("customer")==null?"":request.getParameter("customer");
String account=request.getParameter("account")==null?"":request.getParameter("account");
byte[] bCustomer = new byte[35];
byte[] bAccount= new byte[10];
if(customer.length()>=35){
bCustomer= customer.substring(0,35).getBytes();
}else{
byte[] temp=customer.getBytes();
for(int i=0;i<bCustomer.length;i++){
if(temp.length>i){
bCustomer[i]=temp[i];
}else{
bCustomer[i]=32;
}
}
}
if(account.length()>=35){
bAccount= account.substring(0,35).getBytes();
}else{
byte[] temp=account.getBytes();
for(int i=0;i<bAccount.length;i++){
if(temp.length>i){
bAccount[i]=temp[i];
}else{
bAccount[i]=32;
}
}
}
String host = "localhost";
String sResp="";
DatagramSocket s = null;
try {
s = new DatagramSocket();
byte[] buffer;
String data= new String(bCustomer)+new String(bAccount);
buffer = data.getBytes();
InetAddress ia = InetAddress.getByName(host);
DatagramPacket dgp = new DatagramPacket(buffer,
buffer.length,
ia,
3590);
s.send(dgp);
s.receive (dgp);
sResp=new String(dgp.getData());
} catch (IOException e) {
out.println();
} finally {
if (s != null) {
s.close();
}
}
%>
<html>
<body>
<%=sResp%>
</body>
</html> |
|