1 package WebProgramingDemo; 2 3 import java.io.IOException; 4 import java.io.OutputStream; 5 import java.net.Socket; 6 import java.net.UnknownHostException; 7 8 public class SocketDemo { 9 10 /** 11 * @param args 12 * @throws IOException 13 * @throws UnknownHostException 14 */ 15 public static void main(String[] args) throws IOException { 16 17 Socket s=new Socket("192.168.2.103",10002); 18 OutputStream out=s.getOutputStream(); 19 out.write("Java".getBytes()); 20 s.close(); 21 } 22 23 }
时间: 2024-10-15 13:45:08