在java中使用UDP发送文件时出现EOF异常?

时间:2014-03-30 18:05:51

标签: java multithreading sockets tcp udp

我正在尝试使用此链接从代码发送文件

Emulate UDP Over TCP in multithread Server & Client

但是我得到了EOF异常,我不知道为什么这段代码会出现这样的错误,我加倍检查代码,看起来是对的,我会感激任何帮助,我需要这段代码对于我的论文。在此先感谢!!!!

  SERVER: Accepted connection.
  SERVER: receivedput C:\Users\Nika\workspace\test\10MB.txt
  THREAD: put C:\Users\Nika\workspace\test\10MB.txt
  *** Ready to receive file on port: 60829 ***
  *** The file will be saved as: Recieved-10MB.txt ***
  *** Expecting to receive: 104857600 bytes ***
  Mar 30, 2014 11:17:39 PM udpemu.CLIENTConnection run
  SEVERE: null
  java.io.EOFException
  at java.io.ObjectInputStream$BlockDataInputStream.readFully(Unknown Source)
  at java.io.ObjectInputStream.readArray(Unknown Source)
  at java.io.ObjectInputStream.readObject0(Unknown Source)
  at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
  at java.io.ObjectInputStream.readSerialData(Unknown Source)
  at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
  at java.io.ObjectInputStream.readObject0(Unknown Source)
  at java.io.ObjectInputStream.readObject(Unknown Source)
  at udpemu.UDPFileReceiver.deserialize(UDPFileReceiver.java:126)
  at udpemu.UDPFileReceiver.<init>(UDPFileReceiver.java:52)
  at udpemu.CLIENTConnection.run(CLIENTConnection.java:60)
  at java.lang.Thread.run(Unknown Source)

0 个答案:

没有答案