You Are Here:

Community: Developer Discussion Boards

Reply « Previous Thread | Next Thread »

#1 Old Datagram Connection - 2003-04-28, 07:33

Join Date: Apr 2003
Posts: 12
abhijithvr
Offline
Registered User
we are developing a server to commnunicate with Midlets for Games .When we use socket some phone emulators do no identify the port (7210).Its ony working in with HttpConnection .
and our server is not working for Http.Is it possible to use Datagram Connection in MIDP.Datagram Connection is specified in API
Reply With Quote

#2 Old 2003-04-28, 08:03

Join Date: Mar 2003
Posts: 101
Location: Canada
LiamQ
Offline
Regular Contributor
Current Nokia phones only support HTTP in MIDlets.
Reply With Quote

#3 Old Datagram Connection - 2003-04-29, 06:48

Join Date: Apr 2003
Posts: 12
abhijithvr
Offline
Registered User
Thanks for reply

but when we tested with socket in 7650(Series 60 ) phones its working

connection.open("socket://server:port");
Reply With Quote

#4 Old 2003-05-21, 19:45

Join Date: May 2003
Posts: 4
kmerl
Offline
Registered User
I tried to connect using datagram, but i'm getting NullPointerException. Are you able to connect using datagram?
Reply With Quote

#5 Old 2003-05-22, 16:11

Join Date: Mar 2003
Posts: 16
gerodol
Offline
Registered User
I have tried also the socket connection on 7650.

It works... up to a certain point.

The program I tested opens a bidirectionnel socket
url= "socket://<host>:<port>";
c = (StreamConnection) Connector.open(url,Connector.READ_WRITE, false);
and creates input and output stream.

there is a button to send data to the server, and a thread to receive data from the server and display them.

What happens is : the midlet receives data from the server, displays them OK, but as soon as the midlet tries to send data to the server, it looks like the socket is blocked : data are never received on the server side, and data sent by the server are no more displayed on the phone.
Reply With Quote

#6 Old j2me midp version - 2003-06-02, 16:51

Join Date: Jun 2003
Posts: 24
barryIyer
Offline
Registered User
could u plz tell me what version of java MIDP u using for Socket Connection
I would like to know if any version of nokia do have support for tcp or datagram socket support in J2ME Midp.

and do Midp 1.0 has tcp or udp socket support
Reply With Quote

#7 Old 2003-06-02, 17:37

Join Date: Mar 2003
Posts: 16
gerodol
Offline
Registered User
to barrylyer :

A phone needs not provide tcp socket or udp datagram support in order to be MIDP 1.0 compliant. If you want to create a socket connection, you have to do the following :
url= "socket://<host>:<port>";
c = (StreamConnection) Connector.open(url,Connector.READ_WRITE, false);

On phones that support socket connections (e.g. nokia 7650) this works. If however the phone does not support socket, Connector.open(...) will just throw a "socket not supported" exception.
Reply With Quote

#8 Old Socket Connection - 2003-06-04, 06:09

Join Date: Jun 2003
Posts: 24
barryIyer
Offline
Registered User
Hi gerold thanx for your reply.
But, i still have a doubt on this.

Why is it that , there are different versions of sdk or MIDP/CLDC versions in each model of phone?

I mean to say that , is there any standard version of java which i can follow for different phones.

Im currently using java wireless toolkit 2.0 and 1.0.4_01 from sun.

If i compile my code in 2.0 which uses java MIDP 2.0 i get no problem. But the same code when compiled under 1.0.4_01 which uses java MIDP 1.0 shows compilation errors in Socket.

How can choose the SDK or the exact version of MIDP which has support for sockets.

And is there and version of MIDP 1.0.x which has support for Socket.
Reply With Quote

#9 Old 2003-06-04, 10:30

Join Date: Mar 2003
Posts: 16
gerodol
Offline
Registered User
The code I put in my previous message does compile with WTK under 1.0.4_01 , which I am using for developments .

The ServerSocketConnection and DatagramConnection classes are not part of MIDP1, only of MIDP2, however I did not use these classes. I wrote :

c = (StreamConnection) Connector.open(url,Connector.READ_WRITE, false);

where url starts with "socket://..."

This compiles OK, and at runtime phones that do not implement sockets throw an exception.

Hope this helps.
AG
Reply With Quote

#10 Old Thanx - 2003-06-04, 16:33

Join Date: Jun 2003
Posts: 24
barryIyer
Offline
Registered User
Hi gerodol
Thanx a lot ya
Hope im getting it right.
Reply With Quote

#11 Old hi guys - 2005-08-02, 08:37

Join Date: Oct 2003
Posts: 120
alice77
Offline
Regular Contributor
hi i too facing the same probelm ,i have my J2SE Datagram server running on port number 17000,and the app is running on emualotr is working fine when it local address as i chnage the address to the static address it never responds to that ,

I see that meesage from clients nevers reaches the server and no error is traced at all on the client side too.

So can anyone help me out on this,please.
Reply With Quote

#12 Old Smile Re: Datagram Connection - 2007-03-02, 19:28

Join Date: Mar 2007
Posts: 1
jjpara
Offline
Registered User
I had a problem my server not receiving data sent from the client running on the phone (But the same client was working fine with emulator). flushing data after writing to the buffer did work for me
Reply With Quote

#13 Old Re: Datagram Connection - 2008-05-08, 15:29

Join Date: May 2008
Posts: 3
fravemel
Offline
Registered User
I have the same problem, I have a datagram server application and a midlet which sends datagrams to server. In the emulator everithig is ok but when I install the midlet on my Nokia N95, no data reach to the server. The ip addres is ok, no firewalls,???
CLDC 1.1 Mido 2.1.
what do you mean when you say flushing data. There is no flush method on datagram connection nor Datagram????
Last edited by fravemel : 2008-05-08 at 15:35.
Reply With Quote

#14 Old Re: Datagram Connection - 2008-05-08, 15:41

Join Date: Nov 2007
Posts: 2,029
Location: Rome, Italy
Send a message via MSN to jappit Send a message via Skype™ to jappit
jappit's Avatar
jappit
Offline
Forum Nokia Champion
You should flush() the OutputStream instance you use to send data to server.

Pit


www.jappit.com - mobile and web blog
Reply With Quote

#15 Old Re: Datagram Connection - 2008-05-08, 16:20

Join Date: Sep 2007
Posts: 18
x_ploit_x
Offline
Registered User
On the N95 an IAP has to be defined before your network communications are allowed to go through...
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia