TOP

Java的socket通信的demo
2014-11-04 21:00:10 】 浏览:9864
Tags:Java socket 通信 demo

  Java代码


  package test.socket;


  import java.io.BufferedReader;


  import java.io.DataInputStream;


  import java.io.IOException;


  import java.io.InputStreamReader;


  import java.io.OutputStream;


  import java.io.PrintStream;


  import java.net.ServerSocket;


  import java.net.Socket;


  import java.net.UnknownHostException;


  public class TalkMe {


  public static void main(String[] args) {


  System.out.println("请输入:IP地址:");


  TalkMe talk = new TalkMe();


  talk.listener().start();


  try {


  talk.talker(new BufferedReader(new InputStreamReader(System.in)).readLine()).start();


  } catch (IOException e) {


  e.printStackTrace();


  }


  }



Java的socket通信的demo https://www.cppentry.com/bencandy.php?fid=81&id=11069

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇初探JDK6javax.script(javascrip.. 下一篇Java做的比较完善的FTP连接上传下..