这是关于用JAVA创建Socket的一段代码:
import java.io.* ;
import java.net.* ;
public class SocketTest
{
	public static void main( String[] args )
	{
		try{
				Socket s = new Socket(“time-A.timefreq.bldrdoc.gov” , 13 ) ;
				BufferedReader br = new BufferedReader( new InputStreamReader( s.getInputStream() ) ) ;
				boolean more = true ;
				while( more )
				{
					String line = br.readLine() ;
					if ( line == null )
					more = false ;
					else
					System.out.println( line ) ;
				}
			}catch( Exception e)
			{
				e.printStackTrace() ;
			}
	}
}
                     Post a comment now »
                            本文目前不可评论
            
    
    
    Sorry, the comment form is closed at this time.

No comments yet.