java - Socket Exception : Connection Reset -
socket soc=new socket("whois.internic.net",43);//creating socket. inputstream in=soc.getinputstream(); //getting input stream outputstream out=soc.getoutputstream(); //getting output stream string str="mhprofessional.com"; out.write(str.getbytes()); int c; while((c=in.read())!= -1) { //this line 11!..commenting out works fine. system.out.print((char)c); } soc.close();
see image
how solve it. gives same error on eclipse , on jdk..
a whois
request terminated \r\n
. request isn't legal, peer closing connection, or perhaps resetting it. or perhaps server won't service client.
java sockets
No comments:
Post a Comment