Jump to content
  • Advertisement
Sign in to follow this  
Endemoniada

[java] Writing to Socket ?

This topic is 4899 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!