当前位置: 技术问答>java相关
怎样用Java语言写通过HTTP协议传送数据的程序啊?
来源: 互联网 发布时间:2015-07-21
本文导语: 要通过HTTP协议在两台机器之间传送数据,请问怎样用Java实现?谢谢! | import java.io.*; import java.net.*; public class FileSizeFromURL { public static final void main(String[] args) { URL url; ...
要通过HTTP协议在两台机器之间传送数据,请问怎样用Java实现?谢谢!
|
import java.io.*;
import java.net.*;
public class FileSizeFromURL {
public static final void main(String[] args) {
URL url;
URLConnection conn;
int size;
if(args.length != 1) {
System.out.println("Usage: FileSizeFromURL ");
return;
}
try {
url = new URL(/tech-qa-java/args[0]/index.html);
conn = url.openConnection();
size = conn.getContentLength();
if(size
import java.net.*;
public class FileSizeFromURL {
public static final void main(String[] args) {
URL url;
URLConnection conn;
int size;
if(args.length != 1) {
System.out.println("Usage: FileSizeFromURL ");
return;
}
try {
url = new URL(/tech-qa-java/args[0]/index.html);
conn = url.openConnection();
size = conn.getContentLength();
if(size