WEB开发网
开发学院WEB开发Jsp 一个Scocket实例程序 阅读

一个Scocket实例程序

 2008-01-05 19:07:33 来源:WEB开发网   
核心提示: import java.io.*;import java.net.*;public class EchoServer1{ public static void main(String[] args ){ try{ServerSocket s = new ServerSocket(8500);Socket incom

 

 
import java.io.*;

import java.net.*;

public class EchoServer1

{ public static void main(String[] args )

{ try

{

ServerSocket s = new ServerSocket(8500);

Socket incoming = s.accept( );

BufferedReader in = new BufferedReader

(new InputStreamReader(incoming.getInputStream()));

PRintWriter out = new PrintWriter

(incoming.getOutputStream(), true /* autoFlush */);

out.println( "Hello! Enter BYE to exit." );

boolean done = false;

while (!done)

Tags:一个 Scocket 实例

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接