Applet like chat server

Hi!
I`m trying to do a chat server in applet whith sockets. I changed a chat server aplication to a applet but this server joing the browser.
Is possible to do this? If not, how can i do a applet to talk whith another (peer-to-peer) without use socket?
thanks for any help!
Alexandre Camy

Use a Servlet or JSP on the webserver to transmit messages from one peer applet to another applet

Similar Messages

  • SocketPermissions for Chat Server/Client Applet

    Hi,
    I've coded a chat server/client applet and found that I need to set socketpermissions when using over the net.
    I put the following line in my java.policy file under my jdk
    permission java.net.SocketPermission ":6288", "connect,accept, listen";
    but it still tells me:
    java.security.AccessControlException: access denied(java.net.SocketPermission 217.0.0.1:6288 connect, resolve)
    any ideas? or am I doing something wrong?
    Also I havent set anything for my applet, and wouldnt know how to? if you do have to set permissions for that, do you put the permissions in with the code or something?
    Thanks in advance.
    Matt.

    ah, dont worry, I've got it fixed.
    that 217.0.0.1 address is because I typed the error by the way, usually it would have my IP.
    problem was I had forgot to recompile with my new assigned IP, d'oh!

  • Trying to produce a java chat server

    Would like produce a working client/server chat system, as basic as possible but able to listen and talk to each other. Any chat servers how-to examples I've come across never seem to work.
    Would like to understand why applets don't work when I open the web page but do work when I view using the appletviewer. I use Internet Explorer 4 i think, java version 1.3.0_02
    would you understand at least part of this error which appears when I run a chat server
    exception:com.ms.security.SecurityExceptionEx[Client.<int>]:cannot access "194.81.104.26":5660
    (the error is all one line no spaces)
    the following code is one of the programs I've been working on and I receive the above error, appletviewer doesn't work so i think that means something is wrong with the code, client side as the server side works well, it listens etc
    // Client side
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    public class Client extends Panel implements Runnable
    // Components for the visual display of the chat windows
    private TextField tf = new TextField();
    private TextArea ta = new TextArea();
    // The socket connecting us to the server
    private Socket socket;
    // The streams we communicate to the server; these come
    // from the socket
    private DataOutputStream dout;
    private DataInputStream din;
    // Constructor
    public Client( String host,int port ) {
    // Set up the screen
    setLayout( new BorderLayout() );
    add( "North", tf );
    add( "Center", ta );
    // Receive messages when someone types a line
    // and hits return, using an anonymous class as
    // a callback
    tf.addActionListener( new ActionListener() {
    public void actionPerformed( ActionEvent e ) {
    processMessage( e.getActionCommand() );
    // Connect to the server
    try {
    // Initiate the connection
    socket = new Socket( host, port );
    // Recieved a connection
    System.out.println( "connected to "+socket );
    // Create DataInput/Output streams
    din = new DataInputStream( socket.getInputStream() );
    dout = new DataOutputStream( socket.getOutputStream() );
    // Start a background thread for receiving messages
    new Thread( this ).start();
    } catch( IOException ie ) { System.out.println( ie ); }
    // Called when the user types something
    private void processMessage( String message ) {
    try {
    // Send it to the server
    dout.writeUTF( message );
    // Clear out text input field
    tf.setText( "" );
    } catch( IOException ie ) { System.out.println( ie ); }
    // Background thread runs this: show messages from other window
    public void run() {
    try {
    // Receive messages one-by-one, forever
    while (true) {
    // Get the next message
    String message = din.readUTF();
    // Print it to our text window
    ta.append( message+"\n" );
    } catch( IOException ie ) { System.out.println( ie ); }
    // ClientApplet
    import java.applet.*;
    import java.awt.*;
    import java.io.*;
    import java.net.*;
    public class ClientApplet extends Applet
    public void init() {
    //String host = getParameter( "host" );
         String host="194.81.104.26";
         //int port = Integer.parseInt( getParameter( "port" ) );
         int port =5660;
    setLayout( new BorderLayout() );
    add( "Center", new Client( host, port ) );
    // server
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class Server
    // The ServerSocket is used for accepting new connections
    private ServerSocket ss;
    // A mapping from sockets to DataOutputStreams. This will
    // help us avoid having to create a DataOutputStream each time
    // we want to write to a stream.
    private Hashtable outputStreams = new Hashtable();
    // Constructor and while-accept loop all in one.
    public Server( int port ) throws IOException {
    // listening
    listen( port );
    private void listen( int port ) throws IOException {
    // Create the ServerSocket
    ss = new ServerSocket( port);
    // ServerSocket is listening
    System.out.println( "Listening on "+ss );
    // Keep accepting connections forever
    while (true) {
    // The next incoming connection
    Socket s = ss.accept();
    // Connection
    System.out.println( "Connection from "+s );
    // Create a DataOutputStream for writing data to the
    // other side
    DataOutputStream dout = new DataOutputStream( s.getOutputStream() );
    // Save this stream so we don't need to make it again
    outputStreams.put( s, dout );
    // Create a new thread for this connection, and then forget
    // about it
    new ServerThread( this, s );
    // Get an enumeration of all the OutputStreams, one for each client
    // connected to us
    Enumeration getOutputStreams() {
    return outputStreams.elements();
    // Send a message to all clients (utility routine)
    void sendToAll( String message ) {
    // We synchronise on this because another thread might be
    // calling removeConnection()
    synchronized( outputStreams ) {
    // For each client ...
    for (Enumeration e = getOutputStreams(); e.hasMoreElements(); ) {
    // ... get the output stream ...
    DataOutputStream dout = (DataOutputStream)e.nextElement();
    // ... and send the message
    try {
    dout.writeUTF( message );
    } catch( IOException ie ) { System.out.println( ie ); }
    // Remove a socket, and it's corresponding output stream, from our
    // list. This is usually called by a connection thread that has
    // discovered that the connectin to the client is dead.
    void removeConnection( Socket s ) {
    // Synchronise so sendToAll() is okay while it walks
    // down the list of all output streams
    synchronized( outputStreams ) {
    // Removing connection
    System.out.println( "Removing connection to "+s );
    // Remove it from our hashtable/list
    outputStreams.remove( s );
    // Make sure it's closed
    try {
    s.close();
    } catch( IOException ie ) {
    System.out.println( "Error closing "+s );
    ie.printStackTrace();
    // Main routine
    // Usage: java Server <port>
    static public void main( String args[] ) throws Exception {
    // Get the port # from the command line
    int port = Integer.parseInt( args[0] );
         //int port = 5000;
    // Create a Server object, which will automatically begin
    // accepting connections.
    new Server( port);
    // ServerThread
    import java.io.*;
    import java.net.*;
    public class ServerThread extends Thread
    // The Server that spawned
    private Server server;
    // The Socket connected to our client
    private Socket socket;
    // Constructor.
    public ServerThread( Server server, Socket socket ) {
    // Save the parameters
    this.server = server;
    this.socket = socket;
    // Start up the thread
    start();
    // This runs in a separate thread when start() is called in the
    // constructor.
    public void run() {
    try {
    // Create a DataInputStream for communication; the client
    // is using a DataOutputStream to write to us
    DataInputStream din = new DataInputStream( socket.getInputStream() );
    // Over and over, forever ...
    while (true) {
    // ... read the next message ...
    String message = din.readUTF();
    // ... sending printed to screen ...
    System.out.println( "Sending "+message );
    // ... and have the server send it to all clients
    server.sendToAll( message );
    } catch( EOFException ie ) {
    // This doesn't need an error message
    } catch( IOException ie ) {
    // This needs an error message
    ie.printStackTrace();
    } finally {
    // The connection is closed for one reason or another,
    // so have the server dealing with it
    server.removeConnection( socket );
    <body bgcolor="#FFFFFF">
    <applet code="ClientApplet" width=600 height=400>
    <param name=host value="127.0.0.1">
    <param name=port value="5660">
    [Chat applet]
    </applet>
    </body>

    Hi!
    Go to
    http://www.freecode.com/projects/jchat-java2clientserverchatmodule/
    probably u will het the answer..
    Jove

  • Referencing a "locally installed" Java applet from a server-based HTML page

    How does one reference a "locally installed" Java applet from a server-based HTML page (i.e. via the applet, object, or embed tags)? I have seen references in documentation that this is possible, but I have not seen any examples. I have tried a few things, but nothing seems to be working.
    Some background...
    I'm working on a web site that aggregates Internet video. For many users, I would like the site to work "without" requiring Java to be installed (or any prompts, etc.). This version of the site allows users to stream videos directly over the Internet and does not require any sort of access to the local system.
    However, in addition, I have a download manager that can be installed on the local system. Currently, it's a Windows-based "service" that is always running in the background, downloading files, etc. (with plans to later support other OSes).
    My dilemma is trying to communicate between my web site running in the local browser (executing JavaScript code) and the download manager. I call this component the "gateway". I need the gateway to be able to do the following:
    1) Pass user credentials from the web browser UI to the download manager (so it can communicate with my servers).
    2) Check the status of downloaded videos
    3) Launch a local media player (such as Windows Media, QuickTime, etc.) (or perhaps tell the download manager to launch the media player).
    Under Windows XP, I have an ActiveX control that can do these things. It communicates with the download manager via reading/writing to a shared XML configuration file.
    Unfortunately, under Vista and IE7 Protected Mode, ActiveX controls have become very restricted and my gateway no longer works. As such, I am looking at using Java for the gateway (also giving me the additional benefits of supporting additional browsers and OSes).
    From my understanding, I believe I can created a "face-less" Java applet, whose methods can be called from JavaScript. Ideally, I'm thinking I could install the applet onto the local system at the same time the download manager is installed. This would give the applet the security permissions it needs to communicate with the download manager.
    Thanks for any help and suggestions!

    Hi,
    Put the .jar file and the .class file in the path mentioned in one of the aliases in the plsql.conf file like /images or create
    a seperate directory and create an alias like /applets "path" in the plsql.conf file.
    <html>
    <body>
    <applet code=com.chartapplet.chart.BarChartApplet
    codebase=/applets/
    archive=/applets/chart.jar width=300 height=200>
    <param name=background value="white">
    </body>
    </html>
    Hope this helps.
    Thanks,
    Sharmila

  • Lync 2010 client connecting to 2013 persistent chat server

    Since we never had Group Chat in our 2010 environment, I have no idea how it works and now that we have 2013 Persistent Chat, I am struggling with getting the Lync 2010 connected. The 2013 client works just fine as it is integrated into the client. I found
    out Lync 2010 needs a separate Chat client to run along side the IM client.
    I installed this client but from there I have no idea how to connect it to the 2013 Chat server. I created the endpoint on the Lync 2013 server according to the article
    http://technet.microsoft.com/en-us/library/jj204901.aspx but something else needs to be done. I just don't know what. Not even sure where to start looking. Many of our Lync clients have
    to use 2010 because the OS is XP so I need to find out how to get these users to work with Persistent Chat.
    I am not sure what the point is of creating the End point according to the article. I am sure its necessary but not sure how it fits into the clients using it to connect. What does the article mean when it says "Next, configure Persistent Chat clients
    to use that SIP address as their contact object". Do you need Group Chat functioning in 2010 for this to even work?
    The problem is we never had Group Chat with 2010 so I am sure there are some settings missing like DNS records etc...

    If you have users running legacy clients (such as Microsoft Lync 2010 these users might find the default Persistent Chat URIs difficult to work with and difficult to use when pointing their legacy client towards the pool. Because of this,
    administrators need to use the New-CsPersistentChatEndpoint cmdlet to create an additional contact object for the pool, a contact object that provides a friendlier, easier-to-use URI.
    Lisa Zheng
    TechNet Community Support

  • Developing a chat server ...

    Dear all
    I am planning to develop a chat server to be used locally in my company. I want the members of this server to be able to connect to thier msn and yahoo messenger contacts.
    Is it possible? How can I do it? detailed explaination, please.
    even give any useful links...
    Best Regards

    do you mean some program like JBuddy Messenger,
    you can try this, it is a good example.
    currently it supports AIM, MSN, ICQ, Yahoo and JBuddy protocol.

  • Instance of an applet running at server

    Hello there,
    Is there a way to find the instance of and applet that is running at a remote server.
    Client is IE browser.
    Thanks

    NTushar wrote:
    By external I mean that anything other than the Applet being worked on.That doesn't really narrow it down.
    It can be another Applet, Frame or maybe just a console application. The main concern is not the application.Well, yes it is. For example, a 1963 Dodge Dart cannot access your applet.
    But one thing is certain, whatever the application may be it has no relation with the Applet.Like that Dodge Dart. Sorry, it can't be done.
    Therefore there has to be some way by which the Application finds about the Applet, and so I thought what could be better than having a reference to the instance of the Applet.
    Summing it up, there is an Applet over the internet and a reference to it has to be found.
    Clear Enough.So, you're asking if there is some universal way that anything in the universe can see the applet. The answer is no.
    If you narrow the field down a bit, you can make it possible. Here are the three main ways that come to mind:
    1) other applets running in the same environment can see the applet
    2) if the applet acts as a network server of some sort, other applications (not necessarily Java ones) that have access to that host, could see it. This would require signing the applet, and configuring hardware and software firewalls to allow access, which might be a good idea.
    3) The applet could be made to access periodically a server, to update status information and look for commands.

  • Send data from applet to web server

    Hi,
    I want to send data(event notification) to resource through web server using url.
    Like,As long as perticular action or event is occuring I am sending that message to url.
    I reffered Sevlet theory uses HTTPMessage,but I am confused how should start and what would be feasible?
    Even when I run my code I am not finding browser.How should I place an applet in web server page?
    Regards,
    Palak
    Message was edited by:
    palak_shah

    Hi
    I agree usage of HttpClient is a better and a simple method.
    But If your Application Requirements are Simple you may go by using URL & URLconnection Objects in java.net package.
    Just to Add In You Can Checkout the links given below to have a better understanding of how the communication works...
    The Example APPLET code:
    http://mindy.cs.bham.ac.uk/AppletServletExample/EgApplet.java.txt
    The Example SERVLET code:
    http://mindy.cs.bham.ac.uk/AppletServletExample/EgServlet.java.txt
    and the Example AppletDemo Class
    http://mindy.cs.bham.ac.uk/AppletServletExample/EgApplet.class
    Hope this helps :)
    REGARDS,
    RaHuL

  • Hi, I would like to know if is it possible to install windows on mac pro , because I need to have some application like SQL server and visual studio, and they could not be install on mac

    hi, I would like to know if is it possible to install windows on macbook pro , because I need to have some application like SQL server and visual studio, and they could not be install on mac

    Windows on a Mac

  • J2ME J2EE(servlet jsp) chat server

    want to make a chat server using J2ME(fronend) and J2EE(server) . Could anybdy tell me some sample applications on the net or tutorials that can help

    Darryl.Burke wrote:
    Why, is Google broken?Hey you dont have to be rude to the guy ... suggest a few or dont reply

  • On certain sites (like chats), the shift symbols are not working correctly.

    On certain sites (like chats), the shift symbols are not working correctly, but shift+letters works fine. I've tried changing the set keyboard language, as well as the character encoding, but nothing works. I don't have this problem in IE.

    Hello there.
    Although possibly not related to your problem, I have to remind you that the version of Firefox you are using at the moment has been discontinued and is no longer supported. On top of this, it has known unpatched bugs and security problems. I urge you to update to the latest version of Firefox, for maximum security, stability, performance and usability. You can get it for free, as always, at [http://www.getfirefox.com getfirefox.com].
    As for your issue, I'm not sure if this is the case, but there is a little know keyboard shortcut to change the keyboard language on Windows. And it's very annoying, since it's easily triggered. I don't know exactly which one it is, but I think it's CTRL+SHIFT, the ones on the right. I suggest you ask Microsoft for support on this one. Firefox doesn't control keyboard languages.

  • My simple chat server does not send messages to connected clients

    Hi!
    I´m developing a chat server. But I can not get it work. My client seems to make a connection to it, but my server does not send the welcome message it is supposed to send when a client connects. Why not?
    removedEdited by: Roxxor on Nov 24, 2008 10:36 AM

    Ok, I solved my previous problem and now I have got a new really annoying one.
    This is a broadcasting server which meand it can handle multiple clients and when one client sends a message to the server, the server should broadcast the message to all connected clients. It almost works, except that the server just sends the message back to the last connected client. The last connected client seems to steal the PrintStream() from the other clients. How can I solve that?
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.lang.Character;
    import java.io.OutputStream;
    import java.util.Vector;
    public class ChatServer extends MIDlet implements CommandListener, Runnable
         private Display disp;
         private Vector connection = new Vector();          
         private TextField tf_port = new TextField("Port: ", "", 32, 2);               
         private Form textForm = new Form("Messages");
         private Form start_serverForm = new Form("Start server", new Item[] {  tf_port });
         private Command mExit = new Command("Exit", Command.EXIT, 0);
         private Command mStart = new Command("Start", Command.SCREEN, 0);
         private Command mDisconnect = new Command("Halt server", Command.EXIT, 0);
         ServerSocketConnection ssc;
         SocketConnection sc;
         PrintStream out;
         public ChatServer()
              start_serverForm.addCommand(mExit);
              start_serverForm.addCommand(mStart);
              start_serverForm.setCommandListener(this);
              tf_port.setMaxSize(5);
              textForm.addCommand(mDisconnect);
              textForm.setCommandListener(this);
         public void startApp()
              disp = Display.getDisplay(this);
              disp.setCurrent(start_serverForm);
         public void pauseApp()
         public void destroyApp(boolean unconditional)
         public void commandAction(Command c, Displayable s)
              if(c == mExit)
                   destroyApp(false);
                   notifyDestroyed();
              else if(c == mStart)
                   Thread tr = new Thread(this);
                   tr.start();
              else if(c == mDisconnect)
                   try
                        sc.close();                              
                   catch(IOException err) { System.out.println("IOException error: " + err.getMessage()); }
                   destroyApp(false);
                   notifyDestroyed();
         public void run()
              try
                   disp.setCurrent(textForm);
                   ssc = (ServerSocketConnection)Connector.open("socket://:2000");
                   while(true)               
                        sc = (SocketConnection) ssc.acceptAndOpen();     
                        connection.addElement(sc);                                                  
                        out = new PrintStream(sc.openOutputStream());
                        textForm.append(sc.getAddress() + " has connected\n");
                        ServerToClient stc = new ServerToClient(sc);
                        stc.start();
              catch(IOException err) { System.out.println("IOException error: " + err.getMessage()); }
              catch(NullPointerException err) { System.out.println("NullPointerException error: " + err.getMessage()); }
         class ServerToClient extends Thread
              String message;
              InputStream in;
              SocketConnection sc;
              ServerToClient(SocketConnection sc)
                   this.sc = sc;
              public void run()
                   try
                        in = sc.openInputStream();
                        int ch;
                        while((ch = in.read())!= -1)                         
                             System.out.print((char)ch);
                             char cha = (char)ch;                              
                             String str = String.valueOf(cha);                    
                             out.print(str);
                             //broadcast(str);
                             textForm.append(str);                              
                        in.close();
                        //out.close();
                           sc.close();
                   catch(IOException err) { System.out.println("IOException error: " + err.getMessage()); }
    }

  • Does Oracle have Extended Stored Procedure like SQL Server and Sybase?

    Hi, i am new to Oracle. I want to know if...
    Does Oracle have Extended Stored Procedure like SQL Server and Sybase?
    If it does not have, then how can i call outside program written in C or JAVA from the Database stored procedure or trigger?

    refer to this link on external procedures
    http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a76956/manproc.htm#11064

  • Force user to connect to specific Persistent Chat server

    We plan to have 2 persistent chat servers in a single pool that will span 2 sites.
    1 Persistent Chat server in Site A
    1 Persistent Chat server in Site B
    Is there a way to force users in Site A to connect to the Persistent Chat server in Site A and for users in Site B to connect to the Site B Persistent Chat server?

    That is possible.
    For example, you have on DNS server DC01 in site A, and you only have a DNS A record point to the IP address of persistent chat server in site A, then you use DC01 as the DNS server for users in site A.
    You have on DNS server DC02 in site B, and you only have a DNS A record point to the IP address of persistent chat server in site B, then you use DC02 as the DNS server for users in site B.
    But it is not recommended. If one persistent server is down, users in one site won’t have group chat feature.
    Lisa Zheng
    TechNet Community Support

  • Project Server 2010:- How to add Own Workspace filter in workspace web part like project server 2007

    Hi All,
    I am using project server 2010.
    Can some one advise me how can I add Own Workspace filter option in workspace web part like project server 2007 which is showing all projects name page by page. There no filter option available. I am not sure if there is any out of box feature. 
    Thanks in Advance..

    Nitin,
    PS2010 shows by default the workspaces you have permissions to. Unfortunately, there is no more filtering options available.
    The only solutions are to write a custom webpart, or develop your own SSRS Report, which you can customize the way you want.
    Refer to Paul's excellent blog post on this topic here:
    http://pwmather.wordpress.com/2011/08/05/custom-projectserver-project-site-workspace-view-in-pwa-ps2010-ps2007-epm-msproject-ssrs/
    Cheers,
    Prasanna Adavi, Project MVP
    Blog:
      Podcast:
       Twitter:   
    LinkedIn:

Maybe you are looking for

  • Creating a socket behind a proxy server

    How can I create a socket to a server if the client is behind a proxy server? I know java.net's HTTP-related classes have built-in proxy server support but this is not for a HTTP-based application.

  • Whenever i press shuffle it will just play the song over and over, how do i get it to play different songs instead of repeating?

    My ipod touch will not shuffle songs it will just repeat the same song in less i press skip, how do i get it to shuffle again? please help

  • Reg: CIN

    Dear All, During CENVAT Utilization, If the Cenvat availed is not sufficient for payment of Central excise duties to the Government, then will debit PLA thru TR6C & do the utilization. What is the process for VAT, if the VAT payable is more than VAT

  • How to compute maximum user per AP

    Hi Guys, Im setting up my WLAN, im confused because i dont know how do i compute the maximum user per client per AP. Im using AP 1020 series. For example if i have 20 clients if 802.11b,c,a how's the bandwith is being affected when the number of user

  • Autocomplete does not work in CVI 9.0

    IDE does not show the auto complete member of the structure. The issue is very similar in the post described here. And then when I look at the bug fix for the post here it mentions that it is fixed in CVI 2009 which I believe is the same as CVI 9.0.