Unable to connent to server in my simple Client/server Tic Tac Toe


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Unable to connent to server in my simple Client/server Tic Tac Toe

  1. #1
    Donno Guest

    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.

  2. #2
    MarkN Guest

    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.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center