The Artima Developer Community
Sponsored Link

Java Answers Forum
how to connect via socket

2 replies on 1 page. Most recent reply: Apr 8, 2002 8:49 AM by Thomas SMETS

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Andrzej Dr??d?

Posts: 1
Nickname: andro
Registered: Feb, 2002

how to connect via socket Posted: Feb 26, 2002 2:38 PM
Reply to this message Reply
Advertisement
I'm trying to open a client socket:

new Socket(addr, port)

and I keep getting en exception - sth about SocketPermission and connecting and resolving.

Ofcourse there's a server running on the addr/port.

I tried to grant the permission:
new SocketPermission(addr + port, "connect,resolve"),
but it didn't work.

What am I doing wrong?


John Fox

Posts: 2
Nickname: john
Registered: Apr, 2002

Re: how to connect via socket Posted: Apr 5, 2002 10:27 AM
Reply to this message Reply
all you have to do is put a try loop around the whole program and then catch exceptions statement. ie.

try {
...code here...
}catch (Exception e) {}

This should sort it out

Thomas SMETS

Posts: 307
Nickname: tsmets
Registered: Apr, 2002

Re: how to connect via socket Posted: Apr 8, 2002 8:49 AM
Reply to this message Reply
I believe you are in an Applet ?
Your applet should then be granted the right to connect to another server via the
policy.properties file (as far as I remember)
You cannot grant it to your self, you have to request it & the user can either allow or refuse.
The other solution is signing the Applet, which means that the user will grant yuo al the rights you request simply 'cause he trusts you !

Thomas,

Flat View: This topic has 2 replies on 1 page
Topic: having trouble with java applets Previous Topic   Next Topic Topic: Precision problem with float variable

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use