• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

joeG

[java] Java Socket Protocols

5 posts in this topic

Which protocol is java.net.Socket based on? I am trying to develop an application-specific protocol. I need to know if I should handle ''packet'' sizes or if the protocol that java.net.Socket is based on should handle packet sizes. As I mentioned in an earlier post, there is no way to control the send/receive buffers in JDK 1.1, so, therefore, the programmer is on their own as far as controlling packet size? Or not?
0

Share this post


Link to post
Share on other sites
Whoa guy, you might need to do some reading on networking before you go writing any network applications. java.net.Socket is a class that represents a socket connection, not a protocol. You make your own protocol by defining a way that a client and server can transmit data through (or over) a socket connection. Generally, protocols are unaware of any transmission packets. And lastly, why not just wrap your socket''s input stream in a buffered reader? so you''d have a buffered socket.... just a thought.
0

Share this post


Link to post
Share on other sites
I''m sorry, I meant to ask the question, "Which protocol is java.net.Socket sitting on?" The real question is, "why does sending ''packets'' (''packet'' roughly equals an array full of bytes sent at once) that are larger than X amount of bytes per packet, clog the connection indefinitely (and I mean I''ve waited a lonnnnnnnng time for it to send one of these ''packets'').

And, theoretically, if you''re not able to send more than X amount of bytes over a connection then why should BufferedReader be able to????

Plus the reason I asked about which protocol does java.net.Socket sit on, is because I''m curious to discover if the underlying protocol should''ve handled a ''packet'' of data that was larger than what the buffer could handle. If not, then I should reduce the size of the packets I send through the socket. If so, then I should investigate another part of my program.

Thanks for the help though
0

Share this post


Link to post
Share on other sites
quote:
Original post by joeG

I''m sorry, I meant to ask the question, "Which protocol is java.net.Socket sitting on?" The real question is, "why does sending ''packets'' (''packet'' roughly equals an array full of bytes sent at once) that are larger than X amount of bytes per packet, clog the connection indefinitely (and I mean I''ve waited a lonnnnnnnng time for it to send one of these ''packets'').

And, theoretically, if you''re not able to send more than X amount of bytes over a connection then why should BufferedReader be able to????

Plus the reason I asked about which protocol does java.net.Socket sit on, is because I''m curious to discover if the underlying protocol should''ve handled a ''packet'' of data that was larger than what the buffer could handle. If not, then I should reduce the size of the packets I send through the socket. If so, then I should investigate another part of my program.

Thanks for the help though


Umm... I don''t know very much about these protocols, but in most games (I suspect that you are adding this in your game, correct me if I''m wrong) "packet" size is defined by user, he can choose the packet size between Isdn 64k, Isdn 128k, 56k, 33k, 28k, and 14k. And this way packets are optimized for each modem speed. Of course this requires that your protocol can handle these packet sizes

Doh, neverver mind, you asked the protocol and I answered pacets size, I hope this helps someone...


Time comes, time goes and I only am.
0

Share this post


Link to post
Share on other sites
First off, wrapping your socket''s input stream in a buffered reader allows it to read more information than it normally can handle and store it for later. You dont'' specifically set packets sizes unless you are working with UDP (I think). TCP/IP guaran-damn-tees that all your information will arrive at it''s destination. Socket and URL classes will use TCP/IP to transmit data. MultiSocket and classes that begin with Datagram use UDP. All of this should be transparent to your program. If it isn''t, you are doing something wrong/very advanced/very uneccasary. If your program just stalls it''s probably because it''s not connecting the socket correctly. You should setSoTimeout(int milliseconds) before you try to read from it. Then the read() will throw an InterruptedIOException. If you check out the client/server example on the networking trail, it doesn''t mention TCP/IP at all.

Don''t confuse network protocols like TCP/IP or UDP with application protocols like HTTP or FTP.
0

Share this post


Link to post
Share on other sites