Sending mouse pointer co-ordinates to multiple clients

Hi. I used the MouseMotionListener to get mouse pointer co-ordinates and send those values to one single client. Now i want to know how i could send those co-ordinate values to multiple clients at the same time? If i use multi-threading then what all the steps should i do in the run() method???

Hi. I tried another way. Its like this.
I declared two global variables x and y for holding two mouse co-ordinates in class a.
class a {
public static int x = 0;
public static int y = 0;
Now in the main method of one class, I accepted client connections and started the thread like this :
socket = server.accept();
thread= new HandlerThread(socket);
thread.start();
Now in the class HandlerThread this is what i did :
class HandlerThread extends Thread {
private Socket s1;
ObjectOutputStream oos;
public HandlerThread(Socket s) {
this.s1=s;
public void run() {
try
oos = new ObjectOutputStream(s1.getOutputStream());
oos.writeObject(a.x);
oos.writeObject(a.y);
catch(IOException e)
System.out.println("Exception"+e);
At the sender side when i moved my mouse pointer on screen, i was able to get the changing mouse co-ordinates value. But at the receiver side, only the initial value of x=0 & y=0 was obtained. I started two client connections and for both i received only the initial value. Can someone tell me what could be the reason for this?? Plz reply.

Similar Messages

  • Multiple clients with same account on a single IMAP server

    Hi,
    I am connecting to a IMAP server using same account but from 2 different machines. From one machine a mark a message as SEEN=FALSE. But on the second machine, the flag will still be TRUE.
    Is there any way to co-ordinate between multiple clients so that all the clients are in sync.
    Regards,
    Nitin.

    I was able to resolve the problem using addMessageCountListener and messagesAdded method, as suggested by you.
    I am now facing another problem. Whenever a new message is received, code inside messagesAdded method gets executed. Here I am trying to spawn another thread and do some stuff. But this new thread is not starting at all. It goes into some JavaMail:EventQueue and does nothing. What is the concept of EventQueue here? How can I get this new thread executed?
    Also will there be synchronization problems in messagesAdded method. Say I received a message and I am processing it in the messagesAdded method. In the mean time another message comes up. How will this behave.

  • How to handle multiple clients with DatagramSocket

    I am trying to handle multiple clients with 1 datagramSocket bind to one port (basically I have only one port to use, and I can not use TCP or any other ports). At the server side I have two threads one for receiving packets and buffering them, another for processing the packets in the buffer and sending replies.
    I can have multiple clients sending datagramPackets to me and I will have to process the packets and send them to DIFFERENT clients. Ex. Client 1 sends datagramPacket to Server which sends the processed packet to Client 2. Also Client 2 sends a datagramPacket to Server which again processes the packet and sends it to Client1. May have Client 3 and 4 doing the same thing at the same time... and so on...
    My root class is creating the datagramSocket(somePort) and two threads (receiver and sender). How can I use the socket that I created in these two threads??
    I have done the following and I am getting "java.net.bindexception". When I am sending stuff from Client1 to Client2 everything is fine but when I start sending something from Client2 to Client 1, I get the bindexception... Client 1 is using port 3000, Client 2 is using port 4000.
    I really don't have a lot of experience in socket programming so I am not sure if there is a much simpler way to do this. I appreciate all the tips and help that I can get...
    Thanks...
    class UDP_serv
         static DatagramSocket udpSocket;
         final static int SERVER_PORT     = 2000;
         public static void main(String[] args) throws SocketException
              udpSocket= new DatagramSocket(SERVER_PORT);
              new DataReceiver().start ();
              new DataSender().start ();
         static class DataReceiver extends Thread
              DataReceiver()
                   Thread.currentThread().setName("DataReceiver");
              public void run()
                   while (true)
                        byte pckt[] = new byte [MaxMsgSize];          
                        DatagramPacket dp = new DatagramPacket (pckt, pckt.length);
                        try
                             udpSocket.receive (dp);
                             //PUSH TO RECEIVE BUFFER
                        catch(Exception e)
                             e.printStackTrace();
         static class DataSender extends Thread
              DataSender()
                   Thread.currentThread().setName("DataSender");
              public void run()
                   while (true)
                        processDataMsg();
          static void processDataMsg() 
             DatagramPacket op;
             InetAddress DA = null;
             int DP = 0;
             byte [] outPacket = null;
             // POP FROM RECEIVE BUFFER
             // SOME PROCESSING HERE     
             // Set Destination Address (DA)
             // Set Destination Port (DP)
             // DA and DP are the forwarding IP and Port addresses
             // not the addresses original packet was sent from.
             try
              op = new DatagramPacket (outPacket, outPacket.length,DA, DP);
              udpSocket.send(op);
             catch (IOException e)
              e.printStackTrace();
    }Also for development and testing purposes, I am running the two clients and the server on the same machine (windows xp-32b) so all of the Destination IP Addresses are 127.0.0.1. and as I said Ports that I am using are 2000, 3000, 4000 (Server, Client1, Client2).

    Hmm I have minimized the code and it seems to be working now.
    I think I have an error in the header portion of the data I am sending, where I am storing the source IP/Port and destination IP/Port. I think the server in the middle is messing these values up while sending them to the destination Client. Because the destination client actually receives the stuff and sends the reply back to the server, but the reply packet's headers has 0/0 as the dest IP / Port...
    Server is giving me java.net.BindException: Cannot assign requested address error when it tries to forward the reply it received from the client2 as the address it is trying to send is 0!
    I guess it doesnt just give this error when you try to open two sockets to the same port...
    Paul, Thanks for the direction on how to proceed... took me a while get the minimized code but at least figured out the problem. Well still have to make sure that is THE problem though :)
    As far as the statics goes how can I change those to non static ones? Where do I make an instance of the top level class that creates the threads? and how do I pass the DatagramSocket to the threads/ if I dont need to pass how do I call or use the datagramSocket I created in the top level class? I mean do I still kinda have it like a global variable on the top?? A very simple example would be much appreciated...
    I think these might be really basic questions but I am having a rough time with the hierarchy in java...

  • Send data to multiple clients from a server

    My problem statement is this:
    A server is created, say X. Multiple clients are created, say A, B & C. If X sends a message to A it should reach only A and should not go to B or C. Similarly if X sends message to B it should not reach A or C. I made a one to one communication with the following code:
    //Server
    import java.io.*;
    import java.net.*;
    class X
    public static void main(String args[])throws Exception
    ServerSocket ss=new ServerSocket(4321);
    try
    Socket s=ss.accept();
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    DataOutputStream out = new DataOutputStream(s.getOutputStream());
    String str=in.readLine();
    out.writeBytes(str+"\n");
    s.close();
    ss.close();
    catch (IOException e){}
    //Client A
    import java.io.*;
    import java.net.*;
    class A
    public static void main(String args[])throws Exception
    try
    Socket s=new Socket("localhost",4321);
    BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream()));
    System.out.println(in.readLine());
    s.close();
    catch(Exception e){}
    }But i dont know how to keep track of each client. Because all the clients sockets are created at the same port, ie. 4321. I think thread will help. But even then i dont know how to identify each client. Somebody please help. Thanks in advance.
    Edited by: sowndar on Dec 5, 2009 1:21 AM

    YoungWinston wrote:
    sowndar wrote:
    Ok. I think i have to attach an unique ID to each client message. So that, with the help of that ID, the server can identify each client. Have i caught ur point?If you don't mind using a port per client, you could do something like a receptionist taking incoming calls (on 4321 only).
    - Hi I'm Client xyz.
    - Hi Client xyz, please call me back on port abcd and I'll put you straight through to our server.
    Since 4321 is an "open line" you might have to have some sort of ID so that Clients know which return messages are meant for them, but messages on the other ports would all be direct Client to Server. Also, the Server is then is charge of port allocation and communication on the "open" port is kept to a minimum.4321 is the socket that the server is listening to. It's not what the actual communication will be carried out over. Run this, then telnet to port 12345 a few times
    public class TestServerSocket {
      public static void main(String[] args) throws Exception {
              ServerSocket server = new ServerSocket(12345);
              while (true) {
                   Socket socket = server.accept();
                   System.err.println(socket.getPort());
    }Notice how each inbound connection is allocated a unique outbound socket.

  • How to control one server with multiple clients via TCP/IP

    I am wanting to control a single server with multiple clients.  Only one client would be active at a time, so there would be no conflict.  I want to use TCP/IP.  So far, I have programmed a cluster that passes data back to the server with no problems.  The challenge come in when a second client is added to the mix.  I have't been able to figure out how to turn each client on and send the appropriate data and then turn it off so it doesn't keep sending the same data to the server. 
    Here are the things that I have considered and did some preliminary testing, but don't really know how to impliment:
    1.  Send a numeric on the front of the cluster packet that tells the server that data is on the way.
    2.  Send a boolean on the front of the cluster packet to somehow turn the server TCP/IP on.
    The problem I have found is that LabVIEW TCP/IP doesn't like to be turned on and off.  If it doesn't get the data it expects, it goes into a reset mode and that kills the response time.
    Any help?

    You should consider implementing a set of simple one-byte commands that can be sent back and forth between the Server and the Clients. You can base all of these ideas off the example in the Example Finder under Networking >> TCP and UDP called Multiple Connections - Server.
    You will have two loops in the server VI: one to wait for new connections, and one to send and receive data from the existing connections. For instance, after one of the clients connects, it can request control of the server to send data to it by sending the character "R" for request. Every time the send/receive loop of the Server executes, the first thing it can do is to check all the existing connections to see if any of the clients have sent a control request ("R"). If so, it will create a buffer (array) of control requests. This could be in the form of Connection IDs or indexes in the array for a particular Connection ID. Your choice.
    After the Server receives a request for contol, if it is not already under control by another client, then it can send a response to the first client on the control request list. For instance, the server could send the first client a "S" command for send. Note that after the clients send their control request, they should execute a TCP Read and wait indefinitely for the server to respond with the one-byte "S" command. Then, once the client in control is finished sending data to the server, it could send the character "X" telling the Server to release it from control.
    The example I mentioned above already does a similar thing. Note how when a client wants to disconnect, they send the letter "Q". You can see this in the Multiple Connections - Client VI. The Server then checks each individual connection to see if it's received this one-byte command, and if it has, it closes the connection to the client. This is what you would want to implement, but instead of having just one command, you'll have to distinguish between a few and build up a buffer of control requests.
    Finally, if a client does decide to disconnect in your application, they could send the command "Q" just like the example above. At this point, close the connection and remove that Connection ID from the array of connections. You will also have to handle the case that this client was in the request control waiting line when it disconnected, in which case you need to delete it from that array as well.
    This will definitely work for you, but it will take some work. Best of luck!
    Jarrod S.
    National Instruments

  • Mouse pointer is unchangeable at 100% scaling in multi monitor setup with different resolutions

    Hi there, I have been asked by one of the moderators of the Windows 8.1 forums to post this topic here.  You can see the thread relating to this post here
    http://answers.microsoft.com/en-us/windows/forum/windows8_1-tms/cant-change-the-cursor-pointer/ae8ad8a0-3ded-4810-a3be-794f6c4830a4?msgId=2bd7082f-f5d1-4b01-8c70-e0d2a754d66f&page=1<o:p></o:p>
    The problem:  The mouse pointer becomes unchangeable in size, type, trails etc when 100% scaling is used.  As in it reverts to the standard small white non-inverted, no trails,
    no shadow 'pointer', no matter what options you select in the 'Mouse' control panel settings.<o:p></o:p>
    This appears to be a scaling problem with the Windows 8/8.1 display, not an actual mouse problem.  Judging by my own and other peoples experience it seems to happen mainly with multi
    monitor setups where different screen resolutions are used.  The issue occurs typically when 100% scaling for all monitors is used or this option is un-ticked and the 'change the size of all items' is on smallest (equivalent to 100%).  <o:p></o:p>
    If the scaling is set to 150% or greater the issue disappears and the mouse pointer becomes fully functional.  Also bizarrely when the scaling is set to 100% if the screen is recorded
    using a screen capture program, the recording of the screen shows the mouse pointer selected in the mouse options and not the default small white cursor that is present when recording it.  Here is a link to a video where I explain and show the problem
    happening on my system.  http://youtu.be/xs2cxoeaq-A<o:p></o:p>
    I have every update installed without exception, latest drivers etc.  I use a 55" 4k screen with 2x1080p monitors in portrait on either side.  All are connected through 1 Nvidia
    GTX 780 6GB graphics card<o:p></o:p>
    Hope you can help us<o:p></o:p>
    thanks<o:p></o:p>
    Jon M<o:p></o:p>

    Hi Jon,
    I'm looking into this issue but it will take me some time to provide a reply. 
    In the meantime I noticed that you have 3 monitors with 1x 55' and 2x27' - please have a try to only connect 1x27' monitor and see if issue persists.
    Also please try to change the screen resolution to a lower size and see if issue persists. 
    Both suggestions are not solution, I just would like to know if it is related to multiple monitor or screen resolution. 
    If you have any feedback on our support, please send to [email protected]

  • Multiple client chat server

    Thanks to the help I got from the good people of this forum today I modified the chat server program which I am making and now it is working a bit better. Right now it can accept several (up to 8) clients and store their open sockets in a SocketCollection list which can later be accessed so that messages get sent to all of them. Problem is that when I send a message, it is displayed instantaneously on the client that sent that message (my machine), but is displayed only after the other clients press enter on the other clients' machines (for testing purposes it was the same machine, different port opened for communication with server which is also on the same machine). To clarify that - all clients and server are the same machine (that shouldn't be a problem, right?). Code for printing incoming data for client program is below:
    while ((fromServer = in.readLine()) != null) {
                if (fromServer!=null){
                       System.out.println(fromServer);
                       System.out.println("print on client screen msg received from server");
                fromUser = stdIn.readLine();
                if (fromUser != null) {
              System.out.println("Client: " + fromUser);
              out.println(fromUser);
    }Code to deliver the message to all clients from the server application is below as well:
    while ((inputLine = in.readLine()) != null) {
                     PrintWriter multiOut;
                   for (int x=0; x<8; x++){
                         System.out.println("INSIDE MULTI-TELL FOR LOOP");
                         if (socketCollection[x]!=null){
                               Socket c=socketCollection[x];
                               try{
                                   System.out.println("tried to send to all\nSocket c = " + c);
                                   out=new PrintWriter(c.getOutputStream(), true);
                                       out.println(c.getInetAddress() + inputLine);
                                catch(IOException ioe){}
    }In the server's DOS window I can clearly see that it enters to display the message to multiple clients and it should send it. The sockets are all different and they point to different ports on different clients' machines. Maybe the problem is just in the client program's code. If you could help me out, it will be greatly appreciated. Thank you very much.

    The sockets get created one by one when each client connects. Afterwards when the thread is made, that socket gets copied into the SocketCollection array which can afterwards be accessed in order for the server to distribute the message to all its connected clients.
    The for loop in the second code example where it takes SocketCollection[x] and gets its outputStream and all that is where it prints the message and sends it to each client (sends it but it is not displayed on the client side until the client sends a message to the server again). My question is how to make it so the client does not have to send a message in order to see the server message (message to all clients) that was sent before.

  • RAS Server allowing multiple clients in and telnet redirection to correct reciever.

    Product being used:
    IOS (tm) 3700 Software (C3725-ADVIPSERVICESK9-M), Version 12.3(26), RELEASE SOFTWARE (fc2)
    cisco 3725 (R7000) processor (revision 0.1) with 118784K/12288K bytes of memory.
    R7000 CPU at 240MHz, Implementation 39, Rev 3.3, 256KB L2 Cache
    MICA-6DM Firmware: CP ver 2940 - 7/24/2002, SP ver 2940 - 7/24/2002.
    Bridging software.
    X.25 software, Version 3.0.0.
    Primary Rate ISDN software, Version 1.1.
    2 FastEthernet/IEEE 802.3 interface(s)
    24 Serial network interface(s)
    24 terminal line(s)
    1 Channelized T1/PRI port(s)
    In combination with a server running:
    tac_plus version F4.0.3.alpha.v9 (Extended Tac_plus)
    • The goal is create a RAS Server to allow multiple clients to call in and separate them via DNIS.
    Then specify an auto-command to send the traffic to the correct receiver of that call.
    We are not stuck on doing this with tacacs if there is a more efficient way of doing this.
    The thought was to only send the authorization to tacacs to allow for the dnis map to point the traffic to the correct receiver.
    aaa authentication login DIALIN none
    aaa authorization exec DIALIN none
    • If we set aaa authentication login DIALIN none it works without any issues but does not go to the tacacs server and therefore does not allow us to use the dnis map commands.
    aaa authentication login DIALIN group AAA-mydial
    aaa authorization exec DIALIN none
    • If we set aaa authentication login DIALIN group AAA-mydial using the aaa group server tacacs+ AAA-mydial it goes out to the tacacs server as expected but then it requires a login ID at least in order to get into a session.
    aaa authentication login DIALIN none
    aaa authorization exec DIALIN group AAA-mydial
    • When we change the aaa authorization exec DIALIN group AAA-mydial it fails and does not even send the information out to the tacacs server.
    aaa authentication login DIALIN “see above for options “
    aaa authorization exec DIALIN “see above for options”
    aaa new-model
    aaa group server tacacs+ AAA-2035554677
    server 172.16.0.109
    aaa group server tacacs+ AAA-2035554570
    server 172.16.0.109
    aaa group server tacacs+ AAA-2035554571
    server 172.16.0.109
    aaa group server tacacs+ AAA-mydial
    server 172.16.0.109
    aaa authentication login DIALIN none
    aaa accounting exec default start-stop group AAA-2035554570
    aaa dnis map enable
    aaa dnis map 2035554677 authorization network group AAA-2035554677
    aaa dnis map 2035554677 accounting network start-stop group AAA-2035554677
    aaa dnis map 2035554570 authentication login group AAA-2035554570
    aaa dnis map 2035554570 authorization network group AAA-2035554570
    aaa dnis map 2035554570 accounting network start-stop group AAA-203554570
    aaa dnis map 2035554571 authorization network group AAA-2035554571
    aaa dnis map 2035554571 accounting network start-stop group AAA-2035554571
    aaa session-id common
    ip subnet-zero
    ip cef
    line con 0
    line 65 88
    no motd-banner
    no exec-banner
    privilege level 15
    no vacant-message
    login authentication DIALIN
    modem Dialin
    transport preferred none
    transport output telnet
    escape-character NONE
    telnet transparent
    line aux 0
    line vty 0
    exec-timeout 0 0
    password cisco
    line vty 1
    exec-timeout 0 0
    transport preferred telnet
    transport input all

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin:0in;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:"Times New Roman";
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;}
    NOTHING LIKE ANSWERING YOUR OWN POST:::
    --Well after looking around I found the following on a forum which seems to have gotten us to our destination but uses local authentication to direct the DNIS numbers to the correct receiving system.  Just need to give things a final polishing to make the configuration as clean as possible.
    hostname Router
    boot-start-marker
    boot-end-marker
    logging buffered 65536 debugging
    enable password cisco
    clock timezone EDT -5
    clock summer-time EDT recurring
    aaa new-model
    aaa user profile TEST
    aaa group server tacacs+ AAA-mydial
    server 172.16.0.109
    !!!!!  Below defines the AAA-mydial group you are sending the accounting information to.
    aaa group server radius AAA-myradius
    server 172.16.0.109 auth-port 1645 acct-port 1646
    !!!!!  Below you are using the DNISTEST local group for authentication and authorization.
    aaa authentication banner ^C^C
    aaa authentication login DNISTEST local
    aaa authorization exec DNISTEST local
    aaa accounting update newinfo
    aaa accounting connection DNISTEST start-stop group tacacs+ group AAA-mydial
    aaa session-id common
    ip subnet-zero
    ip cef
    ip audit po max-events 100
    isdn switch-type primary-ni
    isdn voice-call-failure 0
    isdn logging
    !!!!!  Below you are directing which DNIS number goes to which receiving host.
    username cisco-kid password 0 cisco
    username DNIS##1212 nopassword dnis
    username DNIS##1212 autocommand telnet 172.16.0.5 22 /stream /quiet
    username DNIS##4677 nopassword dnis
    username DNIS##4677 autocommand telnet 172.16.0.6 22 /stream /quiet
    username DNIS##4570 nopassword dnis
    username DNIS##4570 autocommand telnet 172.16.0.7 22 /stream /quiet
    controller T1 1/0
    framing esf
    linecode b8zs
    pri-group timeslots 1-24
    interface FastEthernet0/0
    ip address 172.16.0.35 255.255.255.0
    speed auto
    full-duplex
    interface FastEthernet0/1
    no ip address
    shutdown
    duplex auto
    speed auto
    interface Serial1/0:23
    no ip address
    encapsulation hdlc
    isdn switch-type primary-ni
    isdn incoming-voice modem
    no cdp enable
    interface Group-Async0
    no ip address
    encapsulation slip
    dialer in-band
    dialer-group 1
    async mode interactive
    group-range 65 88
    interface Dialer0
    no ip address
    dialer in-band
    dialer idle-timeout 3600
    dialer-group 1
    ip classless
    ip route 0.0.0.0 0.0.0.0 172.16.0.254
    no ip http server
    no ip http secure-server
    ip tacacs source-interface FastEthernet0/0
    dialer-list 1 protocol ip permit
    !!!!!  Below you are further defining the tacacs server and the encryption key to be used.
    tacacs-server host 172.16.0.109 key cisco
    no tacacs-server directed-request
    radius-server host 172.16.0.109 auth-port 1645 acct-port 1646 key ras-secret123
    line con 0
    !!!!!  Below you are directing all calls to go to DNISTEST for authentication, authorization, & accounting.
    !!!!!  Then we are stripping all prompting so that the connection is completely clean.
    !!!!!  The only issue was that the aaa banner was still there which is why there is a
    !!!!!  “aaa authentication  banner ^C^C” above in the aaa section.
    line 65 88
    no motd-banner
    no exec-banner
    privilege level 15
    authorization exec DNISTEST
    accounting connection DNISTEST
    no vacant-message
    login authentication DNISTEST
    modem Dialin
    transport preferred none
    transport output telnet
    escape-character NONE
    telnet transparent
    line aux 0
    line vty 0 4
    exec-timeout 0 0
    password cisco
    transport preferred telnet
    transport input all
    transport output all
    escape-character NONE
    telnet transparent
    end
    tacacs+ config just needs to have an accounting log file defined and all output will be logged there:
    Here is my tac_plus.cfg file:
    ===========================================================
    key = "cisco"
    accounting file = /var/log/tac_plus-f404.log
    -----------------------  the info below this line is irrelevant  ---------------------------
    ---  Just from me trying to use tacacs for the authentication & authroization----
    user = default {
            login = nopassword
            service = exec {
                   autocmd = "telnet 172.16.0.5 22 /stream /quiet"
    user = Router {
            login = nopassword
            member = dialup
    group = dialup {
            default service = permit
            expires = "Apr 1 2010"
            service = exec {
                    idletime = 15
                    autocmd = "telnet 172.16.0.5 22 /stream /quiet"
            cmd = disconnect {
                    permit .*
    user = test {
            name = "Dial"
            login = nopassword
            member = dialup

  • Modal dialog limiting the mouse pointer and blocking all application

    I wanted to create a modal dialog that blocks all application in my desktop. Only password field be present and exits only if correct password is typed. I also wanted to limit the mouse pointer within the window of the modal dialog. Will that be possible? i have read modality feature of Mustang(beta) and notes there that system modality is not included. Can anybody there give me an idea how to do tricks on blocking all applications of the desktop? I will be much grateful to anybody who could solve this problem. Thnx in advance...

    tnx Sarcommand ..i give up on that, i understand the risk if that feature is included..
    all i wanted is to make an internet cafe client/server that blocks the client's pc interaction if log time is reached.blocking only the keyboard and mouse.
    i have seen so many softwares sets the cursor position within the dialog bounding box only with user and password there. though my other application runs the mouse is still captured on the dialog even the dialog lost focus.
    if that would not be possible I'll just send notification to the client, a dialog that does not block any application.
    now, im going to try if the client can do som action whenever the server sends alert if the client java app is not the focus. i will post next time what hapens.but if you tried already, if u dont mind posting it so others could know it also..
    tnx so much Sarcommand..

  • Accessing the same stateful session bean from multiple clients in a clustered environment

    I am trying to access the same stateful session bean from multiple
              clients. I also want this bean to have failover support so we want to
              deploy it in a cluster. The following description is how we have tried
              to solve this problem, but it does not seem to be working. Any
              insight would be greatly appreciated!
              I have set up a cluster of three servers. I deployed a stateful
              session bean with in memory replication across the cluster. A client
              obtains a reference to an instance of one of these beans to handle a
              request. Subsequent requests will have to use the same bean and could
              come from various clients. So after using the bean the first client
              stores the handle to the bean (actually the replica aware stub) to be
              used by other clients to be able to obtain the bean. When another
              client retrieves the handle gets the replica aware stub and makes a
              call to the bean the request seems to unpredictably go to any of the
              three servers rather than the primary server hosting that bean. If the
              call goes to the primary server everything seems to work fine the
              session data is available and it gets backed up on the secondary
              server. If it happens to go to the secondary server a bean that has
              the correct session data services the request but gives the error
              <Failed to update the secondary copy of a stateful session bean from
              home:ejb20-statefulSession-TraderHome>. Then any subsequent requests
              to the primary server will not reflect changes made on the secondary
              and vice versa. If the request happens to go to the third server that
              is not hosting an instance of that bean then the client receives an
              error that the bean was not available. From my understanding I thought
              the replica aware stub would know which server is the primary host for
              that bean and send the request there.
              Thanks in advance,
              Justin
              

              If 'allow-concurrent-call' does exactly what you need, then you don't have a problem,
              do you?
              Except of course if you switch ejb containers. Oh well.
              Mike
              "FBenvadi" <[email protected]> wrote:
              >I've got the same problem.
              >I understand from you that concurrent access to a stateful session bean
              >is
              >not allowed but there is a
              >token is weblogic-ejb-jar.xml that is called 'allow-concurrent-call'
              >that
              >does exactly what I need.
              >What you mean 'you'll get a surprise when you go to production' ?
              >I need to understand becouse I can still change the design.
              >Thanks Francesco
              >[email protected]
              >
              >"Mike Reiche" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >> Get the fix immediately from BEA and test it. It would be a shame to
              >wait
              >until
              >> December only to get a fix - that doesn't work.
              >>
              >> As for stateful session bean use - just remember that concurrent access
              >to
              >a stateful
              >> session bean is not allowed. Things will work fine until you go to
              >production
              >> and encounter some real load - then you will get a surprise.
              >>
              >> Mike
              >>
              >> [email protected] (Justin Meyer) wrote:
              >> >I just heard back from WebLogic Tech Support and they have confirmed
              >> >that this is a bug. Here is their reply:
              >> >
              >> >There is some problem in failover of stateful session beans when its
              >> >run from a java client.However, it is fixed now.
              >> >
              >> >The fix will be in SP2 which will be out by december.
              >> >
              >> >
              >> >Mike,
              >> >Thanks for your reply. I do infact believe we are correctly using
              >a
              >> >stateful session bean however it may have been misleading from my
              >> >description of the problem. We are not accessing the bean
              >> >concurrently from 2 different clients. The second client will only
              >> >come into play if the first client fails. In this case we want to
              >be
              >> >able to reacquire the handle to our stateful session bean and call
              >it
              >> >from the secondary client.
              >> >
              >> >
              >> >Justin
              >> >
              >> >"Mike Reiche" <[email protected]> wrote in message
              >news:<[email protected]>...
              >> >> You should be using an entity bean, not a stateful session bean
              >for
              >> >this application.
              >> >>
              >> >> A stateful session bean is intended to be keep state (stateful)
              >for
              >> >the duration
              >> >> of a client's session (session).
              >> >>
              >> >> It is not meant to be shared by different clients - in fact, if
              >you
              >> >attempt to
              >> >> access the same stateful session bean concurrently - it will throw
              >> >an exception.
              >> >>
              >> >> We did your little trick (storing/retrieving handle) with a stateful
              >> >session bean
              >> >> on WLS 5.1 - and it did work properly - not as you describe. Our
              >sfsb's
              >> >were not
              >> >> replicated as yours are.
              >> >>
              >> >> Mike
              >> >>
              >> >> [email protected] (Justin Meyer) wrote:
              >> >> >I am trying to access the same stateful session bean from multiple
              >> >> >clients. I also want this bean to have failover support so we want
              >> >to
              >> >> >deploy it in a cluster. The following description is how we have
              >tried
              >> >> >to solve this problem, but it does not seem to be working. Any
              >> >> >insight would be greatly appreciated!
              >> >> >
              >> >> >I have set up a cluster of three servers. I deployed a stateful
              >> >> >session bean with in memory replication across the cluster. A client
              >> >> >obtains a reference to an instance of one of these beans to handle
              >> >a
              >> >> >request. Subsequent requests will have to use the same bean and
              >could
              >> >> >come from various clients. So after using the bean the first client
              >> >> >stores the handle to the bean (actually the replica aware stub)
              >to
              >> >be
              >> >> >used by other clients to be able to obtain the bean. When another
              >> >> >client retrieves the handle gets the replica aware stub and makes
              >> >a
              >> >> >call to the bean the request seems to unpredictably go to any of
              >the
              >> >> >three servers rather than the primary server hosting that bean.
              >If
              >> >the
              >> >> >call goes to the primary server everything seems to work fine the
              >> >> >session data is available and it gets backed up on the secondary
              >> >> >server. If it happens to go to the secondary server a bean that
              >has
              >> >> >the correct session data services the request but gives the error
              >> >> ><Failed to update the secondary copy of a stateful session bean
              >from
              >> >> >home:ejb20-statefulSession-TraderHome>. Then any subsequent requests
              >> >> >to the primary server will not reflect changes made on the secondary
              >> >> >and vice versa. If the request happens to go to the third server
              >that
              >> >> >is not hosting an instance of that bean then the client receives
              >an
              >> >> >error that the bean was not available. From my understanding I
              >thought
              >> >> >the replica aware stub would know which server is the primary host
              >> >for
              >> >> >that bean and send the request there.
              >> >> >
              >> >> >Thanks in advance,
              >> >> >Justin
              >>
              >
              >
              

  • C655D 5210 tosiba black screen with mouse pointer

    I have only had this computer for 8 months. One day I turned it on, and windows kept restarting. After a few trouble shooting steps off the internet, I decided to reinstall windows 7 and lose my data and start all over. The first time it could not repair the computer and asked me to send the information to microsoft. Cannot boot in safe mode, I can get to the setup utility screen. This is a new Windows 7 cd. After several tries, it installed and said it had to restart, (this may happen several times) it only restarted once, then a black screen with a cursor. When I try to boot from the cd, the windows logo apppears, then a black screen with mouse pointer again. Toshiba is no help at all. This is my third Toshiba laptop. The first one did the same thing. But it was out of warranty, the amount they wanted to charge us, i just got another one. My mom's Toshiba just died with no real reason, the old one is in the garbage, and this one is only 8 months old. Toshiba would like us to send the computer in, pay for shipping, wait for 3 weeks, pay to ship it back to us, with a promise that it may not work.
    Please help
    here is the error message when trying to install windows 7
    file:\Boot\BCD
    Statu" 0xc000000f
    An error occured while attempting to read the boot configuration.

    Hi, last try is to install os manually,  a clean os Install (way to go here) 
    regards KalvinKlein
    Thinkies 2x X200s/X301 8GB 256GB SSD @ Win 7 64
    Ideas Centre A520 ,Yoga 2 256GB SSD,Yoga 2 tablet @ Win 8.1

  • Saving string  from multiple clients on a server data structue

    I have a server which receives updates from multiple clients ( in this example, football scores which are updated periodically by the clients.)
    When the server receives the scores it needs to store them and at certain time intervals send the complete list of scores to multiple terminals at various locations.
    I am approaching this task in stages...
    stage 1.
    ..create the clients and server ...test the clients can send the data and the server can receive the data and output to screen..
    this is completed
    stage 2...
    a/ on the server side store the received scores in a data structure (ArrayList<String> is what I'm thinking.)
    b/ periodically output all scores to the screen (maybe every 30 seconds) and empty the ArrayList..am looking at the Timer class for this part..
    stage 3
    create the monitors and output scores to monitors periodically..
    ======================================================
    right now I'm at stage 2a ie trying to store the received scores in a data structure.
    i've created a method saveScore in the StoreScore class which is called by the StoreScore run method...
    The saveScore method creates an ArrayList and adds the score to it...
    Question
    does every thread create a new instance of storedScores and therefore the scores are stored in a multitude of data structures?
    I think the answer is yes and if so then this is not the solution...
    What I'm thinking is , as all scores can be outputted to the server screen via System.out.println, is there not a way of saving all these scores in a single data structure?
    The code below is the server code..
    any advice much appreciated....thank you
    /*=============================================================== */
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.util.concurrent.*;
    class ScoresServer1{
    final static int portNum = 1234; // any number > 1024
    final static int numThreads = 10;
    static ExecutorService pool;
    public static void main(String[] args){
    pool = Executors.newFixedThreadPool(numThreads);
    System.out.println("Server running ...");
    try{  
    ServerSocket servesock = new ServerSocket(portNum);
    // for service requests on port
    while (true){ 
    // wait for a service request on port portNum
    Socket socket = servesock.accept();
    // submit request to pool
    pool.submit(new StoreScore(socket));
    }catch(IOException e){}
    class StoreScore implements Runnable {
    BufferedReader reader;
    Socket sock;
    public StoreScore(Socket clientSOcket) {
    try {
    sock = clientSOcket;
    InputStreamReader isReader = new InputStreamReader(sock.getInputStream());
    reader = new BufferedReader(isReader);
    } catch (Exception ex) { ex.printStackTrace(); }
    public void run() {
    String message;
    try {
    while ((message = reader.readLine()) != null) {
    // System.out.println("latest score: " + message);
    saveScore(message);
    } catch (Exception ex) { ex.printStackTrace(); }
    public void saveScore(String message){
         ArrayList<String> storedScores = new ArrayList<String>();
         storedScores.add(message);
         Iterator<String> t = storedScores.iterator();
              while(t.hasNext()){
                   String s = t.next();
                   System.out.println(s);
    }

    does every thread create a new instance of storedScores and therefore the scores are stored in a multitude of data structures?
    I think the answer is yes and if so then this is not the solution...The answer is yes. However, threads can share data, if they were properly synchronized. You should read the threading tutorial before creating a lot of hard to debug mistakes.
    [http://java.sun.com/docs/books/tutorial/essential/concurrency/]

  • Multiple clients on socket connection

    Hi!
    I understand that it is possible that multiple clients listen to one server (on the same port) and even write to it (then it should be a multi-threaded server).
    But i would like to refuse connectios, if one client is connected. How can I do that?
    In my case I have a (single threaded) server. Now one clients connects. The server waits to receive data from the client and answers, without ever closing the port. that works.
    Now if I connect with a second client, the openicng of the socket in the second client works fine, although the server does not seem to notice the second client. Communication is not possible between the server and the second client, and the server doesn't answer to the first client anymore, although he receives data from it.
    So, since the server does not seem to notice the second client (does not accept the connection) and I don't get an exception at the second client, what can I do?
    Thank you for your help!
    concerned Code (if you want to take a look at it):
    CLIENT:
    socket = new Socket(hostname, echo_port);
    SERVER:
    try
    ServerSocket waitingsocket = new ServerSocket(echo_port);
    try
         socket= waitingsocket.accept();
         System.out.println("Client connected");
         ReaderThread reader = new ReaderThread( this, socket );
         reader.start();          
    catch (Exception e)
    READER:
    public void run()
         while (true)
              try {
                   int bytesRead = inStream.read(inputBuffer,
                   0, inputBuffer.length);
                   readCallback.tcpUpdate(inputBuffer,bytesRead);
              catch (Exception oops)
                   readCallback.tcpUpdate(null,-1);
              

    Just to make sure this is clear: You can NOT have multiple clients on a given socket connection. You CAN have multiple clients connected to a particular port on a given server, but each client will be communicating with the server through a different of socket.
    The usual approach here is to set up a listening ServerSocket on the desired port, call accept() on it, then process the communication from the returned Socket object. This is usually done by spawning a new thread and allowing it to handle the socket communication, while the ServerSocket loops around to another accept() for the next communication.
    Here's an excellent intro to the concepts (the code is really ugly and poorly implemented, but it does a good job of explaining the overall concept). I used this as a starting point, and now (after a whole lot of development) have a pretty sweet extensible web server class that handles template expansion, etc... (I use this as a quick and dirty UI for some of my apps, instead of requiring the user to install a JSP container):
    http://developer.java.sun.com/developer/technicalArticles/Networking/Webserver/
    - K

  • How can I connect multiple clients to a single client ?

    I am currently developing an instant messaging program.I created a server and connected multiple clients to it by using thread logic.However I do not know how to connect multiple client to a single client.
    What shall I do for that?Does anybody know a good tutorial or sample program?Or shall anybody explain me what I shall do for building the Instant Messaging part of my chat program?
    Thank u in advance.

    You may use UDP multicast socket. But since you are using the UDP protocol you might risk losing the data that you send since UDP does not guarantee the safe transfer of data.
    Alternately, you might create a server that allows multiple client to connect to it whose connection Socket objects are then stored in a Vector <Socket> object. The server then sends back data to the connected client about the other clients connected to it. Now when the client wants to send data (like an IM) to another connected client, it has to send a request to the server specifying the client login name and the server in turn streams that particular client's Address and Port to the requesting client. The requesting client then initiates the connection with the other client and then starts a conversation. One more thing, when the client communicates it needs to send information to the server like the name by which it likes to be referenced. In this scenario the server acts like a central repository for clients to query the existence of other clients in the chat room. Each client here runs a thread that listens to incoming connections and when a connection is established, may be opens a IM window or something.
    The third option is to make the server to relay the information from one client to another. Like say, I'm connected to whoopy server and i want to send "Hello" to jackson, then i send the message (ie, Hello) along with the name of the client to which i wish to send it to (ie, jackson). The server then performs a lookup in its Vector <Socket> object and then initiates a connection with jackson and sends the information. However, this method is pretty costly in that you will be wasting a lot of processing behind the server.
    --Subhankar
    P.s. If you stumble upon any other brilliant ideas let me know.

  • Is there a way to keep the mouse pointer in my window

    I would like to change the cursor so that it can not go outside my application window until they exit the program. Is this possible?

    Just because you disagree with its usage does not make
    it an invalid question. Suppose you had an
    application dedicated to real-time monitoring of a
    high-pressure system. In our hypothetical example,
    accessing other parts of the system without first
    properly "dismissing" the application could be
    potentially hazardous - people could get hurt. In
    this case, would it not make sense to make the
    application "system-modal"? Furthermore, it would be
    a convenience to the operator if the mouse pointer
    were trapped in this critical application.
    How would one go about trapping the mouse cursor
    inside this application?Yes, it would make sense to make this application system-modal. And it would also make sense to not allow any other applications to run on the monitoring system. For such an application, then, it would occupy the entire screen and there would be no way to swap away from it to any other application. Which is what several people suggested for this rather non-critical application, I believe.
    But in the ordinary case, where you are running on a system that does allow multiple applications to run, trapping the mouse cursor in a single application is bad manners and an alternate solution should be sought.

Maybe you are looking for