欢迎来到天天文库
浏览记录
ID:37556417
大小:51.00 KB
页数:10页
时间:2019-05-25
《telnet源码例子》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、/**LicensedtotheApacheSoftwareFoundation(ASF)underoneormore*contributorlicenseagreements.SeetheNOTICEfiledistributedwith*thisworkforadditionalinformationregardingcopyrightownership.*TheASFlicensesthisfiletoYouundertheApacheLicense,Version2.0*(the"License");youmaynotuse
2、thisfileexceptincompliancewith*theLicense.YoumayobtainacopyoftheLicenseat**http://www.apache.org/licenses/LICENSE-2.0**Unlessrequiredbyapplicablelaworagreedtoinwriting,software*distributedundertheLicenseisdistributedonan"ASIS"BASIS,*WITHOUTWARRANTIESORCONDITIONSOFANYKI
3、ND,eitherexpressorimplied.*SeetheLicenseforthespecificlanguagegoverningpermissionsand*limitationsundertheLicense.*/importjava.io.IOException;importjava.io.InputStream;importjava.io.OutputStream;importjava.io.FileOutputStream;importjava.util.StringTokenizer;importorg.ap
4、ache.commons.net.telnet.TelnetClient;importorg.apache.commons.net.telnet.TelnetNotificationHandler;importorg.apache.commons.net.telnet.SimpleOptionHandler;importorg.apache.commons.net.telnet.EchoOptionHandler;importorg.apache.commons.net.telnet.TerminalTypeOptionHandle
5、r;importorg.apache.commons.net.telnet.SuppressGAOptionHandler;importorg.apache.commons.net.telnet.InvalidTelnetOptionException;/****ThisisasimpleexampleofuseofTelnetClient.Anexternaloptionhandler*(SimpleTelnetOptionHandler)isused.Initialconfigurationrequestedby*TelnetC
6、lientwillbe:WILLECHO,WILLSUPPRESS-GA,DOSUPPRESS-GA.VT100*terminaltypewillbesubnegotiated.*
*Also,useofthesendAYT(),getLocalOptionState(),getRemoteOptionState()is*demonstrated.Whenconnected,typeAYTtosendanAYTcommandtotheserver*andseetheresult.TypeOPTtoseeareportofthes
7、tateofthefirst25*options.*
**@authorBrunoD'Avanzo***/publicclassTelnetClientExampleimplementsRunnable,TelnetNotificationHandler{staticTelnetClienttc=null;/****MainfortheTelnetClientExample.***/publicstaticvoidmain(String[]args)throwsException{FileOutputStreamfout=nul
8、l;if(args.length<1){System.err.println("Usage:TelnetClientExample1[]");System.exit(1);}String
此文档下载收益归作者所有