🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.lang.java
Article #23349

�ܼ�������

#23349
From: bob
Date: Sat, 02 Aug 2003 06:03
29 lines
2256 bytes
 �����:
���������������datagrampacket:
      DatagramSocket ds=new DatagramSocket();
      Sample sam=new Sample();
      ByteArrayOutputStream bout=new
                          ByteArrayOutputStream(8000);
      ObjectOutputStream out=new ObjectOutputStream(
                            new BufferedOutputStream(bout));
      out.writeObject(sam);
      buf=bout.toByteArray();
      DatagramPacket dp=new DatagramPacket(buf,buf.length,
                          InetAddress.getByName(host),port);
      ds.send(dp);
   �������ܳɹ�����,���ڶ���Ӧ���Ѿ���������ݰ����˰�?
��������յ��İ��з����л�����:
 byte[] buf=new byte[8000];
   DatagramSocket ds=new DatagramSocket(port);
   DatagramPacket dp=new DatagramPacket(buf,buf.length);
   ds.receive(dp);
   ByteArrayInputStream bin=new ByteArrayInputStream(buf);
   ObjectInputStream in=new ObjectInputStream(new
                            BufferedInputStream(bin));
   Sample sam=(Sample)in.readObject();
   �����յ�������������,����:java.io.StreamCorruptedException:
inputstream does not contain  a serialized  object
  �Ҿ���Ӧ���ܶ����������İ�,��ô˵����û�����л��Ķ���?

--
�� ��Դ:���㽭��ѧ���ɰٴ�վ bbs.zju.edu.cn��[FROM: comabob]
Technical Details
Message-ID: <47V0LH$9qP@bbs.zju.edu.cn>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-05!sn-xit-09!supernews.com!216.170.153.135.MISMATCH!tdsnet-transit!newspeer.tds.net!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!news.bylinux.net!news.zixia.net!news.happynet.org!ZJUBBS

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f6cb0,2e75a7ade12c5349,start
X-Google-Attributes: gidf6cb0,public
X-Google-ArrivalTime: 2003-08-01 23:04:09 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-05!sn-xit-09!supernews.com!216.170.153.135.MISMATCH!tdsnet-transit!newspeer.tds.net!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!news.bylinux.net!news.zixia.net!news.happynet.org!ZJUBBS
From: comabob.bbs@bbs.zju.edu.cn (bob)
Newsgroups: cn.bbs.comp.lang.java
Subject: �ܼ�������
Date: 02 Aug 2003 06:03:54 GMT
Organization: �㽭��ѧ���ɰٴ�
Message-ID: <47V0LH$9qP@bbs.zju.edu.cn>
X-Filename: Java/M.1059804161.A
Lines: 29