StreamCorruptedException: invalid stream header

T

tukker

Hi All,
I am new to Java network programing. I wanted to write a server
code..which accept telnet connections and respond.
I used code from the below mentioned link.
http://zerioh.tripod.com/ressources/sockets.html
The server code run successfully. Using client code i was able to
connect to the server successfully.
But using the same code when i tried to login thru terminal server
(windows command prompt) and typed "bye" i see below exception.

java.io.StreamCorruptedException: invalid stream header: 6279650D
at java.io_ObjectInputStream.readStreamHeader(ObjectInputStream.java:
783)
at java.io_ObjectInputStream.<init>(ObjectInputStream.java:280)
at Provider.run(Provider.java:23)
at Provider.main(Provider.java:71)
What could be wrong?

My goal is to write a telnet server in java which can accept telnet
connection from windows command prompt or terminal server.
Please help me on the same.
THanks in Advance
KT
 
T

Tom Anderson

I am new to Java network programing. I wanted to write a server
code..which accept telnet connections and respond.
I used code from the below mentioned link.
http://zerioh.tripod.com/ressources/sockets.html
The server code run successfully. Using client code i was able to
connect to the server successfully.
But using the same code when i tried to login thru terminal server
(windows command prompt) and typed "bye" i see below exception.

java.io.StreamCorruptedException: invalid stream header: 6279650D
at java.io_ObjectInputStream.readStreamHeader(ObjectInputStream.java: 783)
at java.io_ObjectInputStream.<init>(ObjectInputStream.java:280)
at Provider.run(Provider.java:23)
at Provider.main(Provider.java:71)
What could be wrong?

You've misunderstood the purpose of the example. It's using serialization,
which is a way of moving whole java objects through streams. That's
nothing like telnet, which just moves raw text (and a few special control
codes).

tom
 
A

Arne Vajhøj

I am new to Java network programing. I wanted to write a server
code..which accept telnet connections and respond.
I used code from the below mentioned link.
http://zerioh.tripod.com/ressources/sockets.html
The server code run successfully. Using client code i was able to
connect to the server successfully.
But using the same code when i tried to login thru terminal server
(windows command prompt) and typed "bye" i see below exception.

java.io.StreamCorruptedException: invalid stream header: 6279650D
at java.io_ObjectInputStream.readStreamHeader(ObjectInputStream.java:
783)
at java.io_ObjectInputStream.<init>(ObjectInputStream.java:280)
at Provider.run(Provider.java:23)
at Provider.main(Provider.java:71)
What could be wrong?

My goal is to write a telnet server in java which can accept telnet
connection from windows command prompt or terminal server.

For a telnet server you will use plain InputStream possible
wrapped in a BufferedReader - you will not use ObjectInputStream
which is for reading Java objects including the meta data that it
complains are missing.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top