Skip to main content
gamedev.net
🔒 Locked

[java] Writing to Socket ?

Started by Endemoniada Mar 14, 2005 at 5:17 PM 1 replies 950+ views
Original Post
Endemoniada
Endemoniada
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....... Any help would be appreciated. Thanks.
Addictman
Addictman
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
Endemoniada
Endemoniada
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 :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.