源码如下
- import java.io.*;
- import java.net.*;
- class Demo1
- {
- public static void main(String[] args)throws Exception
- {
-
- ServerSocket ss = new ServerSocket(11000);
- Socket s = ss.accept();
- PrintWriter out = new PrintWriter(s.getOutputStream(),true);
- InputStream in=s.getInputStream();
- byte []buf=new byte[1024];
- int len=0;
- while((len=in.read(buf))!=-1){
- System.out.println(new String(buf,0,len));
- }
- out.println("<font color='red' size='7'>客户端你好</font>");
- s.close();
- ss.close();
- }
- }
复制代码
自定义服务端 , 我用telnet访问 一直在等待, 用浏览器打不开 何解 ? |
|