File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java Micro Edition and the fly likes Socket doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Socket doubt" Watch "Socket doubt" New topic

Socket doubt

Girish Nagaraj
Ranch Hand

Joined: Apr 19, 2006
Posts: 153
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

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

Thanks in Advance...
Syam Sathyan George
Ranch Hand

Joined: Apr 26, 2006
Posts: 64
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

(My boss is a Jewish carpenter)
Santhana Lakshmi.S
Ranch Hand

Joined: Aug 16, 2005
Posts: 82
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

Joined: Apr 19, 2006
Posts: 153
I Am using socket to connect to the server.
I agree. Here's the link:
subject: Socket doubt
It's not a secret anymore!