Article View: borland.public.jbuilder.java.api
Article #1073Re: about a socket programm
From: Zhilei Ma
Date: Mon, 03 Jun 2002 08:35
Date: Mon, 03 Jun 2002 08:35
64 lines
2757 bytes
2757 bytes
i use JDK 1.4 in Windows 2000. And are these Object Identifiers useful to
programmers in the network programming? When yes, is there any exsamples?
regards
Zhilei Ma
"Joi Ellis [TeamB]" <joi@aravox.com> д����Ϣ����:3cf77014_2@dnews...
> 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:
<3cfb2a4e$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!cox.net!newspeer1-gui.server.ntli.net!ntli.net!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3cf7483a$1_2@dnews> <3cf77014_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 1089d0,bd515b267b76cac1 X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2002-06-03 01:39:11 PST Reply-To: "Zhilei Ma" <ma_zhilei@web.de> From: "Zhilei Ma" <ma_zhilei@web.de> Newsgroups: borland.public.jbuilder.java.api References: <3cf7483a$1_2@dnews> <3cf77014_2@dnews> Subject: Re: about a socket programm Date: Mon, 3 Jun 2002 10:35:25 +0200 Lines: 66 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 129.69.164.17 Message-ID: <3cfb2a4e$1_2@dnews> X-Trace: dnews 1023093326 129.69.164.17 (3 Jun 2002 01:35:26 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!cox.net!newspeer1-gui.server.ntli.net!ntli.net!newsfeed01.sul.t-online.de!t-online.de!dnews