🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

[�ϼ�]�ܼ�������

#22291
From: �����򡫳�����
Date: Fri, 03 Oct 2003 15:54
85 lines
8118 bytes
������������������������������������������������������������������������������
 ����  comabob.bbs@bbs.zju.edu.cn (bob), ����: Java                           
 ����  �ܼ�������                                                             
 ʱ��  �㽭��ѧ���ɰٴ� (Sat Aug  2 14:03:54 2003)                            
������������������������������������������������������������������������������
ת��վ: PKU!news.happynet.org!ZJUBBS

 �����:
���������������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
  �Ҿ���Ӧ���ܶ����������İ�,��ô˵����û�����л��Ķ���?

������������������������������������������������������������������������������
 ����  atomicheart.bbs@bbs.zju.edu.cn ((ԭ�Ӱ����)), ����: Java              
 ����  Re: �ܼ�������                                                         
 ʱ��  �㽭��ѧ���ɰٴ� (Sat Aug  2 16:30:31 2003)                            
������������������������������������������������������������������������������
ת��վ: PKU!news.happynet.org!ZJUBBS

has your object implemented the serializable interface��
 

������������������������������������������������������������������������������
 ����  comabob.bbs@bbs.zju.edu.cn (bob), ����: Java                           
 ����  Re: �ܼ�������                                                         
 ʱ��  �㽭��ѧ���ɰٴ� (Sat Aug  2 17:30:50 2003)                            
������������������������������������������������������������������������������
ת��վ: PKU!news.happynet.org!ZJUBBS

��Ȼ��
 

������������������������������������������������������������������������������
 ����  compl.bbs@bbs.zju.edu.cn (�Ԩ), ����: Java                            
 ����  Re: �ܼ�������                                                         
 ʱ��  �㽭��ѧ���ɰٴ� (Sun Aug  3 13:34:11 2003)                            
������������������������������������������������������������������������������
ת��վ: PKU!news.happynet.org!ZJUBBS

 
     buf = ds.getData();
     ^^^^^^^^^^^^^^^^^^^^^^^^�����������

������������������������������������������������������������������������������
 ����  comabob.bbs@bbs.zju.edu.cn (bob), ����: Java                           
 ����  Re: �ܼ�������                                                         
 ʱ��  �㽭��ѧ���ɰٴ� (Sun Aug  3 14:27:33 2003)                            
������������������������������������������������������������������������������
ת��վ: PKU!news.happynet.org!ZJUBBS

dp.getData()�õ��ľ��ǹ���dpʱ�õ��Ǹ�buf,
�ҿ�����,��С����һ���,
�������������Ѿ������,лл��æ
 

������������������������������������������������������������������������������
 ����  compl.bbs@bbs.sjtu.edu.cn ( �Ԩ), ����: Java                          
 ����  Re: �ܼ�������                                                         
 ʱ��  ��ˮ˼Դ (Sun Aug  3 14:37:19 2003)                                    
������������������������������������������������������������������������������
ת��վ: PKU!news.happynet.org!news.zixia.net!news.neu.edu.cn!SJTU

�Ǻ�, �����ʲô����ѽ?
Technical Details
Message-ID: <48Vaf2$AOM@bbs.pku.edu.cn>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!news-hub.siol.net!newsfeeds-atl2!sjc72.webusenet.com!sjc70.webusenet.com!news.webusenet.com!maily.cic.tsinghua.edu.cn!news.happynet.org!PKU

Show Full Headers
Complete Article Headers
X-Google-Language: Chinese,GB
X-Google-Thread: f6cb0,a5910ba2048c75d4,start
X-Google-Attributes: gidf6cb0,public
X-Google-ArrivalTime: 2003-10-03 08:56:11 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!news-hub.siol.net!newsfeeds-atl2!sjc72.webusenet.com!sjc70.webusenet.com!news.webusenet.com!maily.cic.tsinghua.edu.cn!news.happynet.org!PKU
From: MASM@bbs.pku.edu.cn (�����򡫳�����)
Newsgroups: cn.bbs.comp.lang.java
Subject: [�ϼ�]�ܼ�������
Date: 03 Oct 2003 15:54:26 GMT
Organization: ����δ��վ
Message-ID: <48Vaf2$AOM@bbs.pku.edu.cn>
Mime-Version: 1.0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 8bit
X-Filename: Java/M.1065196466.A
Lines: 86