Socket 传输
来源:互联网 发布:程序员转行做什么好 编辑:程序博客网 时间:2024/05/01 10:36
public Object sendMessage(String content, String url) throws IOException
{
Object rsObj = null;
long start = System.currentTimeMillis();
BufferedReader r = null;
String rs = "";
try {
URL u = new URL(url);
URLConnection uc = u.openConnection();
uc.setRequestProperty("Connection", "close");
uc.setConnectTimeout(timeOut);
uc.setDoOutput(true);
uc.getOutputStream().write(content.getBytes("utf-8"));
r = new BufferedReader(new InputStreamReader(uc.getInputStream(),
"utf-8"));
String line;
StringBuffer buf = new StringBuffer();
int i = 0;
while ((line = r.readLine()) != null) {
buf.append(line);
}
rs = buf.toString();
rsObj = this.getResult(rs);
} catch (IOException e) {
// TODO: handle exception
String errMsg = "接口异常==sendMessage("+content+","+url+")";
log.error(errMsg);
throw e;
} finally {
try {
if (r != null)
r.close();
} catch (IOException ex) {
// ignore
throw ex;
}
}
log.debug("remote time is : " + (System.currentTimeMillis() - start));
return rsObj;
}
- Socket 传输
- Socket传输文件示例
- Socket传输模式
- Java socket传输
- Socket传输文件
- Socket传输文件_new
- 简单socket传输文件
- Socket传输文件示例
- java Socket传输文件
- opencv iplimage socket 传输
- socket传输文件
- SOCKET传输数据、文件
- Java Socket传输图片
- c# socket 传输文件
- android socket传输
- socket传输类对象
- socket之udp传输
- 使用Socket传输图片
- 10则哲理故事照亮你的前途
- SQL语句 日期格式大全
- Oracle数据日期格式化
- 8个笑话顿悟8个道理
- Java的前途
- Socket 传输
- 网上收集的C++笔试题目(2)
- 网上收集的C++笔试题目(1)
- 网上收集的C++笔试题目(3)
- 网上收集的C++笔试题目(6)
- 网上收集的C++笔试题目(5)
- 网上收集的C++笔试题目(4)
- IDictionary与IDictionaryEnumerator
- 设计模式---微波炉模拟程序