Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Socket doubt

 
Girish Nagaraj
Ranch Hand
Posts: 153
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I Am new to J2ME world.

I Have written a code (Socket Client) which asks for server and port name at the starting.
connects to that web server
makes the request
waits & gets the response
finally displays it...

When I entered valid server & port name I got this Exception:
java.lang.SecurityException: Target port denied to untrusted applications
at com.sun.midp.io.j2me.socket.Protocol.connect(+62)
at com.sun.midp.io.ConnectionBaseAdapter.openPrim(+52)
at com.sun.midp.io.j2me.socket.Protocol.openPrim(+108)
at javax.microedition.io.Connector.openPrim(+233)
at javax.microedition.io.Connector.open(+15)
at javax.microedition.io.Connector.open(+6)
at SocketMIDlet.run(+88)


Why Am I getting this Exception?
Is there any way to get around this?

Thanks in Advance...
 
Syam Sathyan George
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya it looks like you are trying to access a secured port with an untrusted application
There are two possible solutions according to me:

1,Sign your application with a digital signature from thawte or some site like that.

2,use another port that is not used by any os services or another applications.

The second one worked for me,but its stupid.

Regards Syam
 
Santhana Lakshmi.S
Ranch Hand
Posts: 82
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi girish
i am also trying to get the response from the webserver by sending the request from the browser in j2me
but i am not all getting any response from the webserver.
my code is working in emulator and im able to get the response from the webserver.

im not all getting any exception or expected output in the mobile but the connection is getting established.
can you tell me how your sending the request from your application to the server
Thanks a lot
 
Girish Nagaraj
Ranch Hand
Posts: 153
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Am using socket to connect to the server.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic