Share socket connection among applets

Hi all,
I'm working on a web-based Instant Messanger project which use applet as
client. User can open serveral applet (say IE window) to chat with different
persons. I wanna client keep only one socket TCP connection with server
regardless how many applets being opened. Rest of technical problems seems
ok now, just as thread pooling, message recognize, etc.
Chris Chen
Software Engineer
Bleum, Inc.
[email protected]
www.bleum.com

Cant be done.. well maybe can be done..
cant be done..
because a Socket is an ip address and a port number, if a process is using a port then it is denied to another process..
maybe can be done..
well you could use Applet.getApplets() to get your clients to share 1 Socket (ie 1 becomes a master and the others communicate through that...) but only if they are in the same browser page/frame hierarchy, but thats not what you want is it...
work arround...
in the server keep a list of users rather than connections (each user may have a list of connections).
then as a user starts a conversation the communication chanel is stored with the connection.
im guessing that if a user has a few chats going when a person replies to that user you cant figure out which of the users client applets to send the message to...

Similar Messages

  • Share database connection among multiple crystal reports using PULL model

    Hi All,
    Is there any way to share database connection using crystal report PULL method ? I m using crystal report 2011 with visual c# (VS2010). Reports get connected to database server using Oracle Native client drivers.
    Thanks,
    Gaurav

    In crystal report 8.5, we have used "PESetNthTableLogonInfo" (after PELogOnServer got deprecated) which shares the connection among reports. Is there any way to implement the same functionality in crystal reports.
    Thanks,
    Gaurav

  • Socket connection in Applet

    Hi champ,
    I created an server and client chat applet. when i execute server and client application it works fine. but when i use applet for client it throws IONetPermission denied error. I know i have to do some thing in policies. But i cannot do in client machine. So is there any other way to handle. adn i know that it is possible because i have seen few chat which use socket connection and yet client has to do nothing with policy. So there must be some thing to do in server machine. Please help me to find the process that i have to follow in server machine to run this client applet without any error.
    Thanks in advance.
    Nischal

    Security model for the applets doesn't allow you to connect to hosts other then host where you download applet code. To go through that limit you have to sign your applet code or provide a proxy on your web site hosting a applet.
    The good starting point for a code signing and applet security is a http://home.istar.ca/~neutron/java.html

  • Applet socket connection

    Hi,
    I have an applet that connects to a server java console program through a socket connection which works fine from the command line using appletviewer but doesn't work when running in a html page. The applet is not signed however because the applet and server are running on the same machine it shouldn't need to be. I have used socket connections in applets before and have managed to make the connection to server without having it signed but this one is not working for some reason. I have checked the port is opened and again its the same one I have used before so I know its open.
    I am getting the message java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:5000 connect,resolve) when calling:
      Socket s = new Socket(ip,port);I also have a java.policy.applet file in the project root directory which has the following in:
    grant {
      permission java.security.AllPermission;
    };Does anyone know a reason why access could be restricted?

    Night.Monkey wrote:
    Hi,
    I have an applet that connects to a server java console program through a socket connection which works fine from the command line using appletviewer but doesn't work when running in a html page. The applet is not signed however because the applet and server are running on the same machine it shouldn't need to be.Wrong. An unsigned applet can only connect back to the server from where it was downloaded. Your applet comes from www.javawebgames.co.uk and tries to connect to 127.0.0.1.
    Would your server be at www.javawebgames.co.uk there should be no problem.
    I also have a java.policy.applet file in the project root directory which has the following in:
    grant {
    permission java.security.AllPermission;
    };I think this should have zero effect when you are running in the actual browser.

  • How to share internet connection with KDE networkmanager applet

    I mainly use wireless around my house and like to use one computer to share it's wireless to another when installing Arch, until I can get KDE and networkmanager installed so I can easily connect to the wireless. I've always been able to easily share internet connections with Ubuntu, but when I try it with Arch, with Gnome OR KDE (and their respective applets), It just doesn't work.
    Is there some library or backend I need to install to make ICS work?
    Thanks!
    Last edited by MetaMan (2011-09-10 22:12:26)

    If this helps at all, here is what I am currently trying: I open up the network settings KDE Control Module, select "Wired", select the device (eth0) and click edit, and under the "IPv4 Address" tab  selecting "Shared" from the "Method" drop-down.
    Also, to make it clearer, I am trying to share wlan0(on device 1) through eth0 to eth0 on device 2. Also, device 2 is running the Arch setup and I am telling it to connect to eth0 via DHCP after I select the remote mirror to use. I have managed to do this before when device 1 ran Ubuntu.
    I've searched Google, the forums, read the wiki pages for KDE and networkmanager, and can't seem to find a mention of internet connection sharing (pertaining to my usage case; the forums have some posts of people trying to use their computer to broadcast eth0, I'm trying to do the opposite) anywhere on them. In fact, I'll gladly write the section myself if I figure this problem out.
    Hope this extra information helps!

  • Decompile applet and proxify all URL and socket connection and recompile

    Hi,
    Please anybody have idea for the below.
    I need to decomple the applet class file to .java file and need to change all URL and Socket connection to proxify all connections from applet. and recompile the sample applet to make ready to load in browser.
    Thi is to load the applet form the web server through one proxy server. In the proxy server side While loading the applet from web server that applet code need to be changed to modify the URL and connections used in that applet to change the further connection from applet through proxyserver.
    Compile and decompile is not a problem that i can use javac and javap respectively.
    But I want to know how to change all URL and connection in applet. is there any easy way to handle this with out changing the applet code.
    can Anybody help me.
    Thanks and Regards,
    Shiban.

    Not sure how you do that:
    Client <----[HTTPS]-----> Secure Gateway <------[HTTP]------->Web servers
    or
    Internet Explorer/Mozilla <----[HTTPS]-----> proxy <------[HTTP]-------> Google
    Is the above correct?
    If so than what are the proxy settings in IE/Moz, I can specify the proxy address in the
    browsers but not the proxy type (SSL).
    When you want to visit a page like google I gues you just type http://www.google.com in
    the browsers address bar. The browser will figure out how to connect to the proxy.
    Java has got the control panel in the general tabl there is a button "network settings...:"
    I have it to "use browser settings" and this works for me.
    All URL and URLConnections work but the sockets don't (maybe put in a bug report)
    for example games.yahoo.com -> card games -> bridge -> create table
    In the trace I can see:
    network: Connecting http://yog70.games.scd.yahoo.com/yog/y/b/us-t1.ldict with proxy=HTTP @ myproxy/00.00.00.00:80
    network: Connecting socket://yog70.games.scd.yahoo.com:11999 with proxy=DIRECT
    The second one fails because port 11999 is not open (what idiot uses an unassigned
    port for a profesional site is beyond me).
    http://www.iana.org/assignments/port-numbers
    #               11968-11999 Unassiged
    Even if the port was open on the proxy you'll notice with proxy=DIRECT that
    "use browser settings" does not work with socket (bug report??).
    Anyway my advice is to open the java console (windows control panel or javacpl.exe in
    the bin dir of java.home) and make sure it is set to "use browser settings"
    Then enable a full trace:
    To turn the full trace on (windows) you can start the java console, to be found here:
    C:\Program Files\Java\j2re1.4...\bin\jpicpl32.exe
    In the advanced tab you can fill in something for runtime parameters fill in this:
    -Djavaplugin.trace=true -Djavaplugin.trace.option=basic|net|security|ext|liveconnect
    if you cannot start the java console check here:
    C:\Documents and Settings\userName\Application Data\Sun\Java\Deployment\deployment.properties
    I think for linux this is somewhere in youruserdir/java (hidden directory)
    add or change the following line:
    javaplugin.jre.params=-Djavaplugin.trace\=true -Djavaplugin.trace.option\=basic|net|security|ext|liveconnect
    for 1.5:
    deployment.javapi.jre.1.5.0.args=-Djavaplugin.trace\=true -Djavaplugin.trace.option\=basic|net|security|ext|liveconnect
    The trace is here:
    C:\Documents and Settings\your user\Application Data\Sun\Java\Deployment\log\plugin...log
    I think for linux this is somewhere in youruserdir/java (hidden directory)
    Print out the full trace of the exception:
    try{...}catch(Exception e){e.printStackTrace();}
    Then visit the games.yahoo and try to create a new table playing bridge.
    Inspect the trace and see if it works/why it doesn't work.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Applet socket connect behaves wrong.

    Hi,
    I have a very strange behavior from the Socket connect method. When i run the code attached as an applet the connect returns as if the connection is established (no machine on my network with the address 12.12.12.12 and ping to 12.12.12.12 fails as expected).
    When i run it from a command line (in a stadard main) the connect behaves as expected an i get an exception.
    Any ideas? what am i doing wrong? (or is it a known applet behavior???)
    thanks...
    ===========================================================
    the code:
    ===========================================================
    public void start() {
    SocketAddress sockaddr = new InetSocketAddress("12.12.12.12", 16000);
    Socket sock = new Socket();
    try {
    System.out.println("Start conn 1");
    sock.connect(sockaddr, 3000);
    } catch (IOException e) {
    System.out.println("Connect failed");
    e.printStackTrace();
    return;
    if (sock.isConnected()) {
    System.out.println("Connected");
    System.out.println("Connect succ 1");
    Edited by: ohad_atia on Jun 28, 2009 12:25 AM

    here is the applet start code - the rest of the methods are empty:
    (no exception here - that is the problem)
          public void start() {
              SocketAddress sockaddr = new InetSocketAddress("12.12.12.12", 16000);
                     Socket sock = new Socket();
              try {
                   System.out.println("Start conn 1");
                   sock.connect(sockaddr, 3000);
              } catch (IOException e) {
                   System.out.println("Connect failed");
                  e.printStackTrace();
                  return;
              if (sock.isConnected()) {
                 System.out.println("Connected");
              System.out.println("Connect succ 1");
          }the code and output i got when i run it using a command line:
    import java.net.Socket;
    import java.net.SocketAddress;
    import java.net.InetSocketAddress;
    import java.io.IOException;
    public class networktest {
            public static void main(String[] argv) {
                    SocketAddress sockaddr = new InetSocketAddress("12.12.12.12", 16000);
                    Socket sock = new Socket();
            try {
                    sock.connect(sockaddr, 3000);
                } catch (IOException e) {
                    System.out.println("Connect failed");
                    e.printStackTrace();
                    return;
                if (sock.isConnected()) {
                       System.out.println("Connected");
                System.out.print("Connect succ");
    }output:
    Connect failed
    java.net.SocketTimeoutException: connect timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at networktest.main(networktest.java:17)
    thanks for your help

  • Establish socket connection with local pc using Applet

    Hi,
    I want to write an applet embedded in my web application.
    When I access the web application from my PC which is connected to a RFID reader, I need the applet to make a socket connection to the attached RFID reader.
    Is this allow?
    If not, what do I need to make this possible for applet?
    Please advise.
    Thank you.

    HI Helen,
    Just to check.
    He is on XP ?
    He is using AIM 5.9 ?
    He has Tuned the camera and Mic to the App ?
    If he is at Service Pack 2 he has enabled the app through the XP firewall ?
    You have the MAc firewall Off.
    The ports are enabled in your modem.
    Either using UPnP or these actual ports
    5060, 5190, 5678, 16384-16403 for just the AIM stuff.
    Have you changed the Quicktime setting to match your download speed ?
    Can you and he get any of the people or test accounts o this page ?
    http://www.ralphjohnsuk.dsl.pipex.com/ContactTesters.html
    2:34 PM Saturday; April 8, 2006

  • Applet using socket connection always go through proxy server

    Socket connection with socks always go through proxy server
    We have two applets in different codebases using socket to talk to each other, until now nothing new, but the problem is that we are behind a proxy server with socks and because of that, the connection always go through the proxy server even with proxy override point to the applet machine. We have tried a lof of things and until now nothing worked, it looks like the socket is ignoring proxy override configuration. We would like to know if there is a way to solve this problem making the applets comunicate to each other ignoring the proxy server. It should happen when we set the plug-in option to "no proxy host", but it doesn't. Maybe it can be a bug of JVM, I don't know, just maybe, and if it's true, any other good idea would be welcome as well.
    Thanks in advance.

    Hi,
    I am not very much sure if I can help you. In my previous experience, once you set the system property to use the proxy, then the jvm uses the proxy. If you want disable, in your code, you have to disable it.
    like System.setProperty("socksProxyHost","someHost"), Properties props = System.getProperties(); props.remove(("socksProxyHost");

  • Opening a socket from an applet

    I tried to open a socket from an applet to a server on a remote computer and I've got a refusal message.
    When I try it on a server in the local machine, it works.
    What could be the problem ?
    P.S. : when I open the socket from an application in the Java environment, to the same remote server it works ok.

    this is part of the security system built into java and Applets
    unless you sign an Applet it cannot do many "dangerous" things, like..
    access the loacl file system
    connect to any server except the server that it came from

  • Socket connection access denied

    I created a class that handles all the socket level calls for my Applet class. When I'm trying to open the socket, I get an exception saying "access denied (java.net.SocketPermission 172.16.11.63:3333 connect,resolve)". When I open the socket within the Applet class, it opens fine. I would think the socket class would have permissions to the socket because it's being loaded from the same host and the same directory as the Applet. Can someone please explain this to me? Thanks.

    Normally a webserver runs on port 80. If you're connecting to port 3333, then that counts for a different host.
    Morten

  • Connecting an applet to database

    Hello Everybody,
    I have a problem of connecting the applet to the database through a separate java class.
    to be more clear i have a applet which uses a java class file for databse conenction.
    the error i'm facing while doing this is that java.net.socket permission.
    my database is oracle and i'm using thin driver to establish the connection.
    now i have the doubt that is it the right kind of approach.
    i mean can i connect the applet to the database through a normal java class.
    i hope some can get me the solution.
    thanking u in advance
    regards
    RaviTeja

    I suppose your problem is that you get a Security Exception when your applet try to open a JDBC connection to a database located on another server, right?
    To solve the problem, you have to sign your applet with a digital signature or bring the webserver and the database on the same machine.
    (Concerning the digital signatures, look in the forums, and you will find tons of messages about it)

  • Help with an exception when trying to establish a socket connection

    i am trying to make a chat (using an applet for the client).......
    it uses an simple socket connection between the server and clients.....when i connect the client to address 127.0.0.1 or localhost everything works fine, but when i try to connect the client to my DNS name or ip, i get an exception....the exception reads:
    java.security.AccessControlException: access denied (java.net.SocketPermission nextwave.dyndns.org resolve)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
    at java.security.AccessController.checkPermission(AccessController.java:401)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
    at java.lang.SecurityManager.checkConnect(SecurityManager.java:1042)
    at java.net.InetAddress.getAllByName0(InetAddress.java:937)
    at java.net.InetAddress.getAllByName0(InetAddress.java:918)
    at java.net.InetAddress.getAllByName(InetAddress.java:912)
    at java.net.InetAddress.getByName(InetAddress.java:832)
    at java.net.InetSocketAddress.<init>(InetSocketAddress.java:109)
    at java.net.Socket.<init>(Socket.java:119)
    at Client.<init>(Client.java:42)
    at ClientApplet.init(ClientApplet.java:12)
    at sun.applet.AppletPanel.run(AppletPanel.java:347)
    at java.lang.Thread.run(Thread.java:536)
    what is this all about??????
    i'm not that fluent in java, or networking at that, but i'm sure there is something i can do to fix this......
    any help would be greatley appreciated.

    this is why i am not heart-broken that i will be going the other (executable jar) route.......the major deciding factor is the people who will be using this chat will most likley not be able to edit the policy file due to lack of knowledge, and probably won't want to take the time to try.....they would rather download a program, and double-click execute........
    i thank you for taking the time to help me......i have been reading through the posts in this forum, and am seeing it is a good place to get help, so i will be sticking around.....
    mahalo and happy java

  • How to share internet connection using 5G wifi/channel 36~48

    I'm using a 15 inch late 2013 MacBook Pro with retina display running 10.10.1 and iPhone 5S A1530 running iOS 8.1.
    I use an Apple thunderbolt to ethernet adapter at work for internet and it's all cool and fine.
    The problem comes when I try to share the internet connection with my phone through wifi. It's alright if I use channel 1 to 11. But when I try the 5G channels: 36, 40, 44, 48, it just doesn't work. The wifi icon in the top right corner of my screen has a wave animation and then nothing. It just goes back to grey instead of an arrow pointing upwards. In the slimmest hope of a display error, I search nearby wifi signal with my phone and nothing.
    I have a 5G router at home and both my laptop and my phone can connect to its 5G signal. So the hardware should be fine.
    It's weird since it should be working as Apple decided to put an option there for user to choose from all the channels, among which lie the four 5G channels.
    So to conclude, my laptop with a functioning 5G wifi module can share internet connection through 2.4G wifi but not 5G.
    Hope someone could help me with it. Thanks.

    I've turned on NAT and attempted to create a new Subnet using DHCP but it doesn't offer me Airport in the network interface menu (only en0 and fw0). Airport is turned on in network system prefs.
    Have you actually configured the AirPort network with its own IP address settings (in a different subnet from the wired ethernet port)?
    Having the interface enabled isn't enough to make it a viable gateway interface. It needs an IP address/subnet mask too.

  • Is there any way to make a socket connection to a java file on the net?

    Is their anyway to make a socket connection to a java applet that I place on a webhost? I want to connect to a javaapplet from my vb.net program and send commands to it. Like http://www.geocities.com/Sylonious/javafile.jpx:7070
    ?

    Is their anyway to make a socket connection to a java
    applet that I place on a webhost? I want to connect to
    a javaapplet from my vb.net program and send commands
    to it. Like
    http://www.geocities.com/Sylonious/javafile.jpx:7070
    ?You wouldn't have a port in the url, you would need to have the socket open in the applet code. The vb.net program would also need to be on the same server as the applet or you'll have security issues and I doubt that's possible with geocities. I don't know what you would need to communicate with a vb.net if anything, but I'm sure it's possible.

Maybe you are looking for

  • Getting parameters from multipart request

    I'm using org.apache.tomcat.utils.fileupload to parse uploaded files from a multipart form, but unfortunately I can't seem to get normal parameters from such a form with request.getParameter(). Is there a way to use both together?

  • Problem in searching the document

    Hi Experts, We've uploaded a ppt file into our KM repository. Similarly we've uploaded some other files (txt, doc, etc..) at the same location. But the problem here is, when we are searching the ppt document with search option the document (ppt) is n

  • Transfer call from 78xx phone series

    we are experiencing a problem on phone 78xx series  when transfer a call. When the 7861 telephone transfers a call and the called party does not answer, can not resume the call on hold. I configure my sip profile in any particular way?

  • Overlay pages in ADF

    Hi Folks There is a requirement where in I dsplay a table with various columns in a main jspx page , I am having a lot of rows to be displayed in the main jspx page , but if the number of rows exceeds 10 a scroll bar is displayed , I dont want a scro

  • Ichat errors even though ichat not installed

    Hey all, Man Mini "server".  New install. Did NOT install iChat (it is not listed as a service in server admin).  Despite this I get the following errors in system log repeated every three seconds. Jun  4 10:20:27 man1 jabberd/c2s[226]: [8] [::ffff:1