• 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.
Sign in to follow this  
Followers 0
Canvas

Android WiFi HotSpot server and client help

7 posts in this topic

Hello there guys,

 

I've been asking around on many forums asking for some help on an application I am trying to create, Let me first explain the functionally of the application I want to develop

 

Application :

    This application will simply start a server and allow other android devices to connect to the device and play this application together, how I want this to work is, one user will use WiFi, I do apologize the title should not have WiFi hot spot, I just want to use WiFi to send data from one device to another.

Problems :

    I have created a TCP/IP and a Multicast server with java, now looking at Android, Android of course runs java applications, but I don't know as I can't find information about it, if the same code to start a Multicast server will work on a mobile device. All I'm trying to do is, one user will set up a server socket to listen on where clients will connect, once they are connected a thread will be created, and constant data will be send back to the client, this was achieved quite quickly and simple using Java, but with Android I'm not sure if I can do the same code for pc to Android?

 

Here is the code I have so far, but I don't think this does much

wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);

 

I have looked at this http://marakana.com/forums/android/examples/40.html , it gives an example application, but it just sends data to itself, I want to know how I can setup a sock on a mobile device, which can be used to send and receive data via UDP protocol.

 

Any help would be great, I have had no help from anyone so far, and trying to find the right code example is like trying to find a pin in a haystack.

 

Canvas

Edited by Canvas
0

Share this post


Link to post
Share on other sites
Multicast does not work on the general Internet. The problem is that, to join a multicast group, my router has to know about that group, which means that every router on the internet needs to know about the multicast groups that any user on that router *might* want to join -- which is all of them.

Use TCP. And, evenso, if your Android host is behind a NAT gateway, you have to do NAT punch-through, which requires an external introducer.
0

Share this post


Link to post
Share on other sites

I'm using one of the devices as a Wifi hot-spot so that is the "router" as all clients first connect to that using WiFi, I don't want to use TCP because of the extra data being sent over, I want to just send fast and small packets, Would a datagramSocket be a bit easier to work with?

Edited by Canvas
0

Share this post


Link to post
Share on other sites
The protocol overhead of TCP vs UDP is unlikely to be measurable compared to all the other traffic on the network (IP overhead, WiFi overhead, ATM overhead on your cable or DSL, etc.)
That being said, you can use UDP if you want to. Many fine games use UDP. You have to remember that packets may not make it, or may be duplicated, or may be re-ordered, or all three.
0

Share this post


Link to post
Share on other sites

That is not a problem, with the data being send so often data can be lost and the effect will probably not be able to be seen by the naked eye. Also the reason I am asking if I should use a DatagramSocket instead of a MulticastSocket is, I have some code and when I run it I get this error

Java.net.SocketException: No such device

 

When I run this

 

try
		{
			socket.joinGroup( address );
		}
		catch ( IOException e )
		{
			Log.d(TAG, "Error code 0003");
			e.printStackTrace();
		}

 

MulticastSocket works like a radio where it keeps broadcasting it out which is good for my application, but I'm not sure if a DatagramSocket would just be easier because of networking issues.

0

Share this post


Link to post
Share on other sites
Yes; Multicast requires specific support from your network routers and will not work across the Internet.
0

Share this post


Link to post
Share on other sites

Yes; Multicast requires specific support from your network routers and will not work across the Internet.

He isn't attempting to do it across the internet though, Assuming the server is a wifi hotspot that the clients all connect to both broadcast and multicast will work just fine.

a Multicast Socket in Java is a Datagram(UDP) socket with the ability to join groups.

The groups address is NOT the same as the servers address(common mistake), multicast groups use reserved addresses between 224.0.0.0 and 239.255.255.255

The error the OP is getting is most likely due to "address" either not being a proper InetAddress object or it not being created with a valid multicast address.
0

Share this post


Link to post
Share on other sites

Well I'm going to try and create what I did using a DatagramSocket instead of a MulticastSocket, if I get any errors, the code will be put in this topic. Cheers for all the information people.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0