Unable to connent to server in my simple Client/server Tic Tac Toe
public void actionPerformed(ActionEvent event)
{
try {
connection = new Socket(
InetAddress.getByName(event.getActionCommand()), 5000 );
input = new DataInputStream(
connection.getInputStream() );
output = new DataOutputStream(
connection.getOutputStream() );
}
catch ( IOException e ) {
e.printStackTrace();
}
outputThread = new Thread( this );
outputThread.start();
id.setEditable( false );
}
Hi, above is a part of my client source. Briefly, the client interface will
appear a textfied for user to key in IP, once he/she done, this method will
make a connection to the server by caputuring the client input.
There is no problem if I run both client and server application on a same
pc. If I run it on separate PC, the client is not able to connect to the
server. These are the message thrown:
Exception occurred during event dispathcing: java.security.AccessControlException:
access denied <java.net.SocketPersmission 10.100.1.98:5000 connect, resolve>
at java.security.AccessController.checkPermission<AccessController.java:399>
at......
This is my problem, and I am wondering why it can run on the same PC but
not for separate one. Thanks to clear my doubt.
Re: Unable to connent to server in my simple Client/server Tic Tac Toe
Sounds like a policy file issue. You will need to add a permission to the
java policy file for the JVM you are using. The easiest way (not saying
the best) is to add the All permission.
Mark
"Donno" <chungyl@hotmail.com> wrote:
>
>public void actionPerformed(ActionEvent event)
>{
>try {
>connection = new Socket(
>InetAddress.getByName(event.getActionCommand()), 5000 );
>input = new DataInputStream(
>connection.getInputStream() );
>output = new DataOutputStream(
>connection.getOutputStream() );
>}
>catch ( IOException e ) {
>e.printStackTrace();
>}
>
>outputThread = new Thread( this );
>outputThread.start();
>id.setEditable( false );
>}
>
>Hi, above is a part of my client source. Briefly, the client interface will
>appear a textfied for user to key in IP, once he/she done, this method will
>make a connection to the server by caputuring the client input.
>
>There is no problem if I run both client and server application on a same
>pc. If I run it on separate PC, the client is not able to connect to the
>server. These are the message thrown:
>
>Exception occurred during event dispathcing: java.security.AccessControlException:
>access denied <java.net.SocketPersmission 10.100.1.98:5000 connect, resolve>
>at java.security.AccessController.checkPermission<AccessController.java:399>
>at......
>
>This is my problem, and I am wondering why it can run on the same PC but
>not for separate one. Thanks to clear my doubt.