Article View: borland.public.jbuilder.java.api
Article #1065Re: about a socket programm
From: Joi Ellis [TeamB]
Date: Fri, 31 May 2002 12:44
Date: Fri, 31 May 2002 12:44
53 lines
2601 bytes
2601 bytes
Zhilei Ma <ma_zhilei@web.de> wrote:
> Hi all,
> i got a programm like this:
> import java.io.*;
> import java.net.*;
> class Whois
> {
> public static void main(String args[]) throws Exception
> {
> int c;
> Socket s = new Socket("internic.net", 43);
> InputStream in = s.getInputStream ();
> System.out.println (in);
> OutputStream out = s.getOutputStream ();
> System.out.println (out);
> String str = (args.length == 0 ? "osborne.com" : args[0]) + "\n";
> byte buf[] = str.getBytes ();
> out.write (buf);
> while((c = in.read()) != -1)
> {
> System.out.print ((char) c);
> }
> s.close ();
> }
> }
> but how can i unterstand the first two lines in the output:
> java.net.SocketInputStream@19298d
> java.net.SocketOutputStream@8a992f
> what means the IDs "@19298d" and "@8a992f"?
I think of those as heap addresses, object Identifiers, whatever.
You asked the JVM to print the java.net.Socket* objects, so the JVM used
whatever toString() method it could find, and probably ended up on the generic
method on java.lang.Object().
What version of the JDK is the project using? I can't find those classes
in SDK 1.3.x or in 1.4.
--
Joi Ellis (TeamB) http://www.teamb.com/
No direct email, please.
For best results, post on news server newsgroups.borland.com!
Newsgroup Guidelines: http://www.borland.com/newsgroups/guide.html
Only posts which violate the rules in guide.html are subject to cancelation.
Technical Details
Message-ID:
<3cf77014_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!peer.news.opaltelecom.net!newsfeed.wirehub.nl!news-hub.siol.net!feed.cgocable.net!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!lsanca1-snf1!news.gtei.net!enterprise!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnews!not-for-mailReferences:
<3cf7483a$1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,bd515b267b76cac1
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2002-05-31 06:02:08 PST
Sender: Joi Ellis <joi@h-66-134-231-90.CHCGILGM.covad.net>
Message-ID: <3cf77014_2@dnews>
From: "Joi Ellis [TeamB]" <joi@aravox.com>
Subject: Re: about a socket programm
Newsgroups: borland.public.jbuilder.java.api
References: <3cf7483a$1_2@dnews>
User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.2.19-6.2.7 (i686))
NNTP-Posting-Host: 66.134.231.90
Date: 31 May 2002 05:44:04 -0700
X-Trace: dnews 1022849044 66.134.231.90 (31 May 2002 05:44:04 -0700)
Lines: 53
X-Authenticated-User: jellis
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!peer.news.opaltelecom.net!newsfeed.wirehub.nl!news-hub.siol.net!feed.cgocable.net!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!lsanca1-snf1!news.gtei.net!enterprise!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnews!not-for-mail