-1

I want to develop a Java game that works on adhoc wireless environment. Do you know any source that I can search for it and learn for it?

Stewbob
  • 16,759
  • 9
  • 63
  • 107
erogol
  • 13,156
  • 33
  • 101
  • 155

2 Answers2

1

Adhoc and wireless is not related to Java. An ad-hoc wireless network is something that two computers can set up between each other to create a network. At that point your Java game is using a network the same as any other network (the fact that is is wireless and ad-hoc is irrelevant - to Java it looks exactly the same as a wired network for example).

Your java program will then have the same TCP/IP and UDP/IP stack available to it and can use Socket/ServerSocket (TCP) or DatagramSocket (UDP) to communicate.

The following page gives an overview of networking in Java:

http://docs.oracle.com/javase/tutorial/networking/overview/networking.html

And the following page has an example of a very small simple networked java game that might be helpful to get to grips with the basics:

http://www.dr-mikes-maths.com/tictactoe.html

AntonyM
  • 1,602
  • 12
  • 12
0

If you want to create a online game you must learn the following classes:

  1. Java.net.ServerSocket This class will let you host a socket at a specified ip and port.

  2. Java.net.Socket This class will let you to connet to a socket at a specified ip and port.

  3. java.io.InputStream This class will let you send streams from a socket to another.

  4. java.io.OutputStream This class will let you get streams from a socket to another.

  5. java.lang.Thread This class is very important but i cannot describe it. an alternative to this class is the Runnable interface.

These are enough.

SecretAgentMan
  • 2,856
  • 7
  • 21
  • 41
Alfadowen
  • 11
  • 5