Results 1 to 8 of 8

Thread: Problems in Socket Applet

  1. #1
    Join Date
    Jan 2010
    Posts
    70

    Problems in Socket Applet

    I wonder if there was a way to be able to communicate with an applet client sockets? As soon as I start my applet I start my server, I have always a "access denied" when it works perfectly on my JVM locally. What should I do to solve this problem? (I have for now tested only with html and not with jsp). I am using the following as my socket class :
    Code:
    import java.io. *; 
    import java.net.*;
    public class Server (private final static int port = 5000; 
    public static void main (String [] args) 
    throws IOException (ServerSocket ss; ss = new ServerSocket (port); 
    Socket s; Communication sal; sal = new Communication (); Connection c; System. out. 
    System.out.println ("server ready, awaiting shipment at port" + port) while (true) 
    (s = ss. accept () c = new Connection (s, sal) sal. Add (c); c. start ();)) public int getPort () (return port;))
    Please help me in solving my issue.

  2. #2
    Join Date
    Mar 2008
    Posts
    258

    Re: Problems in Socket Applet

    It is very tough to decide what problem exactly that you are facing.!! It would be better if you provide the coding that are using in another applet. Because without that many (including I) members cannot give you an appropriate solutions. So my kind request for you is to provide the coding first and then we will definitely try to resolve your problem.

  3. #3
    Join Date
    Jan 2010
    Posts
    70

    Re: Problems in Socket Applet

    Extremely sorry for not providing enough information in my post. My client applet (which itself launches other windows) :
    Code:
    import java.io. *;
    
     Import javax.swing.JApplet;
    
    
     public class extends JApplet (ClientChat
    
     public void init () (
    	 this. setSize (200, 200);
    	 Window f;
    	 try (
    		 f = new Window ("Cat");
    		 while (true) (
    			 / / Pass information to servers
    			 BufferedReader in;
    		     in = f. getin ();
    			 f. receive ();
    		
    		 )
    	 ) Catch (IOException e) (
    		 // TODO Auto-generated catch block
    		 e. printStackTrace ();
    	 )
    	
     )
     )

  4. #4
    Join Date
    Apr 2008
    Posts
    193

    Re: Problems in Socket Applet

    An applet can not create server socket (that's if you planned to put your first code in an applet, but I doubt AC would not make sense). Log (Client therefore) via socket to a server other than that which comes from the page in which it finds itself (that is to avoid pages that hackers would run applets intended to serve as a relay for spam, for example ). So in your case, simply that your server runs on the same server where have your web page. If it does not work, we post the exception + code associated with the line the exception (we see nothing of what your client in your code).

  5. #5
    Join Date
    Jan 2010
    Posts
    70

    Re: Problems in Socket Applet

    I throw over my html file:
    HTML Code:
    <! DOCTYPE html PUBLIC "- // W3C // DTD HTML 4.01 Transitional //" "http://www.w3.org/TR/html4/loose.dtd">
     <html>
    
        <body style= "margin:auto;">
    
    	 <div style= "width:320px;margin:auto;margin-top:100px;border:5px solid black">
    		 <applet codebase= "bin/" code= "ServerChat.class" height= "80" width= "300" hspace= "10" vspace= "10">
    		 <param name= "ipServer" value= "localhost">
    	 <param name= "portServer" value= "5000">
    		 </ Applet>
    	 </ Div>
    
        </ Body>
     </ Html>

  6. #6
    Join Date
    Jul 2006
    Posts
    286

    Re: Problems in Socket Applet

    Do you sign your code? Indeed, using sockets is to use a hardware component, the network adapter. Outside, access to a hardware device by an applet is restricted by security java browser plugin. This default allows no access. Clearly, an unsigned applet can only act on the elements of the page that contains the point. To go further it is imperative to create a signing certificate and use it to sign code. Thus, when the user tries to execute a code applet that will seek to use its card network to make a socket connection, the signing certificate to be submitted so that it can identify the author of the code and decide to trust or not confirm or deny the execution of code. And obviously the only condition of acceptance that the applet can then create a socket, whether client or server.

  7. #7
    Join Date
    Jul 2006
    Posts
    442

    Re: Problems in Socket Applet

    Indeed, it is troubling. In this case, it is not impossible to imagine a security restriction to your own browser. What do you use as your browser? Anyway, unless you only use your applet, it will have to distribute one day, and there it will be loaded via an HTTP URL, so you do not cut. So much to start with that, and if it does not change your behavior, examine the management of your security, I know from experience that IE in its latest version by default blocks this kind of thing.

  8. #8
    Join Date
    Aug 2006
    Posts
    227

    Re: Problems in Socket Applet

    Regarding the validation of the certificate, it concerns the confidence given to the developer, not that it allows itself. A developer honest when signing the code of its applet knowing that it has access only besion socket will ensure that its code that accesses the socket. At least I think he made the approach by the CAs. It should not imagine that because recognize a signature that will last all the code. Now, such a signature is not free. Then if we know the developer personally and recognize that his signature and that he trusted, there is no need to bother with all this. But if I understand it, when you write an applet itself, assume it is actually needed to be signed, how you doing? You all the rights granted by submitting a certificate created by yourself?

Similar Threads

  1. Replies: 6
    Last Post: 22-07-2011, 10:24 PM
  2. Problems with socket timeout and JRE 1.6
    By ScarFace 01 in forum Software Development
    Replies: 8
    Last Post: 14-09-2010, 09:50 PM
  3. Which one should i buy: AMD Socket AM2 or Intel Socket 1156 ?
    By Liam M in forum Motherboard Processor & RAM
    Replies: 5
    Last Post: 24-12-2009, 11:18 AM
  4. Winsock Socket error 10048 socket bind
    By Theophilus in forum Operating Systems
    Replies: 4
    Last Post: 16-02-2009, 08:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,914,954.55944 seconds with 17 queries