java.net.SocketOutputStream cannot be cast to java.io.DataOutputStream
Posted on 2012-03-28
I built a proxy server processing data for MineCraft.
The proxy program works by itself, and I was able to use it to transfer connections to websites or Minecraft servers. Both worked without issue.
However, now I am trying to read the packets, and it requires that I turn the java.net.SocketOutputStream into a Java.io.DataOutputStream.
Casting does not work, nor does:
to = new DataOutputStream(outgoing.getOutputStream()); // throws the error in the title.
I'm very skilled in C#, but just learning Java. how can I convert this stream? - I'm presuming I just need to know the right casting path though another layer/command.