Networking with ME

Hi Microguys!

I ask this as a total mobile device newbie (I don’t even own a mobile phone).

Do/will mobile devices have a possibility to create socket-like connections to a server? Or between devices?
What are the pre-requisits?
Is there a thing like NIO?

Will it be possible to do online MP action games on mobile devices??

I’d appreciate a short introduction.

Thanks,

  • J

IIRC, the profiles gurantee that you can make http connections, but not all devices/networks support socket level connections. Unless you’re looking for very low latency, high interactivity, http connections should be enough to do the job.

God bless,
-Toby Reyelts

Not all do - but are there some that do??

The background of the question is: I’m creating a network gaming framework that (maybe maybe maybe) will be expanded to mobile devices.

Not I try to make up my mind wether my efforts will be lost if I rely on NIO Channels.

AFAIK, you won’t see java.nio anywhere in the near future for mobile devices.

God bless,
-Toby Reyelts

If you rely on NIO channels you won’t have any issues on the server side, but you won’t be able to have anything resembline NIO on the client side. If you engineer your system such that you can receive moves and such from a web browser then you’lll be guaranteed to work on a J2ME device - otherwise you’re pretty much hosed as MIDP on requires HTTP level functionality. Some devices may support TCP, some may support UDP and some will support all of the protocols, but HTTP is the only guarantee you have.

Hi

J2ME have posibilities on network gaming. You can visit this URL where shows the source code of a example client-server application.

The biggest problem is that J2ME don’t support TCP connections, but we are a good workers and something good can be made.

We need to take advantadge of the multiplayer posibility of java mobile games. There is a great fun there.

is it possible to create server side sockets?
i want to be able to listen for connections from other j2me devices.

IIRC, it is not possible to create a ServerSocket. You’ll need to go the “peer-assisted” route (i.e. client-server).

God bless,
-Toby Reyelts

in the api docs i’ve found:
StreamConnection acceptAndOpen()
Returns a StreamConnection that represents a server side socket connection.
is it of any use?
thanks…

It is only of use if your device supports sockets. For whatever reason, Sun decided not to make socket or datagram functionality a requirement for MIDP.

thanks for your reply.
now i’m wondering why sun has put that method into the api, if it’s not available on all devices. at least they could add a note saying that!
thanks sun…

The javadocs do mention that HTTP is the only mandatory implementation.

But it is a pain to have fragmented support…

and having to poll for data all the time from the client is a bitch, but works nicely.

But in general getting a “non-emulator” build to work consistently is a pain, there are so many bugs in the HTTP clients of the devices…

but when it works it is really cool :slight_smile:

For MIDP 1.0, HTTP client networking is the only mandatory protocol. But MIDP is based on CLDC, and CLDC has a framework that could support datagrams, sockets etc. The CLDC spec also has some examples illustrating what that would look like, and some manufacturers’ MIDP implementations include TCP sockets and even server sockets. But e.g. Nokia’s phones don’t yet support anything but HTTP client networking.

A big constraint is that many phones do their HTTP networking using the WAP protocol stack rather than the TCP/IP protocol stack; the WAP stack doesn’t include TCP or UDP, so the phones simply can’t implement those protocols.

MIDP 2.0 includes official but still optional support for SocketConnection, ServerSocketConnection and UDPDatagramConnection. MIDP phones won’t be out until perhaps the middle of next year, and even then most phones out there will still be MIDP 1.0 phones.

[quote]Hi Microguys!

I ask this as a total mobile device newbie (I don’t even own a mobile phone).

Do/will mobile devices have a possibility to create socket-like connections to a server? Or between devices?
What are the pre-requisits?
Is there a thing like NIO?

Will it be possible to do online MP action games on mobile devices??

I’d appreciate a short introduction.

Thanks,

  • J
    [/quote]
    NIIO is only avaible on JSE 1.4.x

it sis not available on J2ME