[java] Writing to Socket ?

Started by
1 comment, last by Endemoniada 19 years, 1 month ago
Hi guys, I'm using Ethereal to look at the packets I'm sending out. I want to send the exact same packet using my own socket. I created the socket just fine but what should I use to send it ? In the Java examples they use a PrintWriter but I can't get it to work. Do I have to send everything that I see in Ethereal or is the top part the header that Java will automatically include ? The packet in Ethereal looks something like this (ASCII view): ..stuff not ascii......<xml stuff>. Any help would be appreciated. Thanks.
Advertisement
Hi.

You can use most streams that can be constructed over the basic OutputStream
(which you can get from clientSocket.getOutputStream()).

As for ethereal, you only need to send the parts of the packet under the "data" section.
Development blog, The Omega Sector -- http://www.omegasector.org
Thanks man, I got it to work. I''m using ByteArrayOutputStream for now, it's a little clunky but it does the trick.

PS - Norway must be nice :)

This topic is closed to new replies.

Advertisement