发表于: java/j2ee | 作者: | 日期: 2008/11/07 02:11
标签:

这是关于用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() ;
}
}
}

: https://blog.darkmi.com/2008/11/07/384.html

本文相关评论 - 1条评论都没有呢
Post a comment now » 本文目前不可评论

No comments yet.

Sorry, the comment form is closed at this time.