Socket freezes based on client connectivity...

Hello,
We've been suffering through a problem in our game for several months, and I have yet to identify why the problem occurs. I've written a small program that duplicates the problem, perhaps someone here will be familiar with what's causing it, and be able to help.
The problem occurs when one of the connected clients loses internet connectivity (usually this is due to people with microwave style or dial-up connections to the internet that lose their signal). The data continues to be transmitted to their socket, and appears to queue up locally to a certain point. After the queue reaches a certain size, the server thread blocks, and will not continue past the point of sending that data to the 'locked' socket. So a single player's locked connection ends up freezing everyone else's screen updates, as well.
We've been able to emulate the problem by using the WinXP telnet client and bringing up the right-click menu. (This appears to make the telnet client stop accepting data from the server, so the data queues up and the server locks.)
The three source code files to duplicate this problem can be downloaded in an archive from here: http://www.aros.net/~rumour/TestServer.zip
I will also paste the code in-line the post, following the remainder of my message.
The main method is in TestServer, which will bind to port 1234 of the machine on which it's run. To duplicate the problem, use telnet to make a connection to the server. (The server constantly streams data, so that it won't take long for the queue to fill, and the problem to manifest itself.) Launch a second telnet window which you can freeze (as I mentioned, by right-clicking on a WinXP telnet window [so right-click menu, Mark, Copy, Paste, etc., is visible], and then leaving that menu up, seems to be a great way to duplicate the problem) and connect it to the server also. Freeze the 2nd connection, and observe the 1st. After a short period of time, the 1st connection will also stop updating.
My hope with SocketChannels was that it might bypass the problem, however, it occurs with this implementation, as well. (Was trying to force a non-blocking socket solution, in case that was the problem.)
Does anyone have any ideas or experience with a similar problem? We would be most appreciative of any solutions, suggestions, alternatives, or insight into what's going on. And if you'd enjoy seeing the game, please visit http://mtrek.game-host.org - it is a telnet based, real-time space combat game, based on the classic MTrek.
Thank you for your time,
J.
TestServer.java
import java.net.BindException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
public class TestServer {
  public static void main(String[] args) {
    TestConnections tc = new TestConnections();
    tc.start();
    // establish server socket, and bind to a port
    try {
      ServerSocketChannel ssc = ServerSocketChannel.open();
      ServerSocket sc = ssc.socket();
      sc.bind( new InetSocketAddress( 1234 ));
      SocketChannel client;
      do {
        client = ssc.accept();
        if (client != null) {
          System.out.println( "Socket connection accepted: " + client.toString() );
          tc.addClient( client );
      } while( true );
    } catch( BindException be) {
      System.out.println("Error binding to port.");
    } catch( java.io.IOException ioe) {
      ioe.printStackTrace();
TestConnections.java
import java.util.Vector;
import java.nio.channels.SocketChannel;
public class TestConnections extends Thread {
  private Vector clients;
  private int dataLine;
  public TestConnections() {
    clients = new Vector();
    dataLine = 0;
  public void addClient( SocketChannel client ) {
    TestClient tc = new TestClient( client, this );
    clients.addElement( tc );
    tc.start();
  public void removeClient( TestClient client ) {
    clients.remove( client );
  public String getDataLine() {
    // rotate through printable characters, 32-126
    StringBuffer sb = new StringBuffer();
    for (int x = 0; x < 72; x++) {
      sb.append( (char) (((x + dataLine) % 95) + 32) );
    sb.append("\r\n");
    dataLine++;
    return sb.toString();
  public void run() {
    try {
      do {
        Thread.sleep( 10 );
        // loop through all clients, and transmit data
        for (int x = 0; x < clients.size(); x++) {
          TestClient curClient = (TestClient) clients.elementAt(x);
          String transmitString = getDataLine();
          curClient.sendData( transmitString );
      } while( true );
    } catch( InterruptedException ie ) {
      ie.printStackTrace();
TestClient.java
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
public class TestClient extends Thread {
  private SocketChannel client;
  private TestConnections connections;
  public TestClient( SocketChannel clientSocket, TestConnections connectGroup ) {
    client = clientSocket; 
    connections = connectGroup;
  public void sendData( String data ) {
    try {
      client.write( ByteBuffer.wrap( data.getBytes() ));
    } catch( java.io.IOException ioe ) {
      ioe.printStackTrace();
      connections.removeClient( this );
  public void run() {
    try {
      do {
        Thread.sleep(10);
      } while( true );
    } catch( InterruptedException ie ) {
      ie.printStackTrace();
}

I've come to a workaround that, while I'm not particularly happy with it, it works. Before the actual transmission of the data, I instantiate a Timer object that will kill the socket unless the send succeeds within a certain amount of time. The reason I'm not particularly happy with this, is that the transmit method is called very frequently. That's a lot of extraneous Threads getting spawned and killed. I'd prefer to solve this another way, but this is working for the time being.
For instance, in my sample code, I altered the client sendData method to look like:
public void sendData( String data ) {
    try {
      Timer timeToKill = new Timer();
      timeToKill.schedule( new TestTimer( this ), 5000);
      client.write( ByteBuffer.wrap( data.getBytes() ));  // you have 5 seconds to comply
      timeToKill.cancel();
    } catch( java.io.IOException ioe ) {
      ioe.printStackTrace();
      connections.removeClient( this );
  }And added a new class, TestTimer.java:
import java.util.TimerTask;
public class TestTimer extends TimerTask {
  TestClient clientToPotentiallyDestroy;
  public TestTimer( TestClient t ) {
    clientToPotentiallyDestroy = t;
  public void run() {
    clientToPotentiallyDestroy.kill();
    try {
      clientToPotentiallyDestroy.client.socket().close();
    } catch( java.io.IOException ioe ) {
      ioe.printStackTrace();
}Before each write call [ client.write(...) ] in the sendData method, a new Timer thread is created with an arbitrary wait period (I actually lowered it to 1 second in the game itself, since it should immediately be able to dump the data to the socket unless it's already been queuing up for quite some time) if the write succeeds within that time, the Timer gets cancelled, and program continues. If the write does not succeed within the specified time, the TestTimer object gets called from the Timer, and the 'offending' socket gets closed by force. This kills the client Thread which ends up blocking the program execution because of the size of the send queue.
Hopefully, this may help someone else encountering a similar problem, although I'm still hoping for a more elegant solution.
--J.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Socket stuff... Connection works but neither client nor server will receive

    Okay, here's the deal...
    I have a serversocket and a clientsocket in the same program. I have the client connect to 127.0.0.1 and the server accepts a connection. Both server and client make a thread to listen to one another. Then the server sends something to the client. The client doesn't catch anything. When I use the client to send to the server, the server also doesn't catch anything. Also, when I add the line "System.out.println(fromServer.readln())" after the connecting instead of in a separate thread, it gets totally weird and starts jumping back and forth between lines within the same try block. The line order gets random and some get executed twice. I'm using the IntelliJ software to program / debug. The application always gets stuck at the line I mentioned before. . I have no idea what the hell is going on. Can any one please please help me? =(
    P.S. I could add the code but I'm not sure what to add and if I added all of it it'd kind of be a lot so... if you need to take a look at it tell me what parts you want or if you want the full thing or whatever. I don't see a way to attach files to posts =p otherwise I could have attached the project.

    try this:
    Client:
    import java.io.*;
    import java.net.*;
    public class client
         Socket soc;
         DataInputStream in;
         PrintStream out;
         public client()
              String str="";
              try
                   soc = new Socket("127.0.0.1",5432);
                   in = new DataInputStream(soc.getInputStream());
                   out = new PrintStream(soc.getOutputStream());
                   while((str=in.readLine())!=null)
                        System.out.println(str);
                   in.close();
                   out.close();
              catch(Exception e)
                   System.out.println(e);
         public static void main(String args[])
              client obj = new client();
    }Server:
    import java.io.*;
    import java.net.*;
    public class server
         ServerSocket ss;
         Socket soc;
         DataInputStream in;
         PrintStream out;
         public server()
              String str="";
              try
                   ss = new ServerSocket(5432);
                   while(true)
                        soc = ss.accept();
                        in = new DataInputStream(soc.getInputStream());
                        out = new PrintStream(soc.getOutputStream());
                        out.println("Connected !!");
              catch(Exception e)
                   System.out.println(e);
         public static void main(String args[])
              server obj = new server();
    }

  • Clients connections not balanced across proxies

    Guys,
    I have 8 Extend clients connecting to 6 proxies. With 3.7, my understanding was by default clients connections should be balanced across available proxies but its not the case always. I see some times client connections are not load balanced at all.
    Have been through -- http://docs.oracle.com/cd/E24290_01/coh.371/e22839/gs_configextend.htm#BEBBIJAI
    I've specified two proxies in the client side config
              <tcp-initiator>             
               <remote-addresses>
                   <socket-address>
                      <address>35.54.42.46</address>
                      <port>9099</port>
                   </socket-address>
                   <socket-address>
                      <address>35.54.42.47</address>
                      <port>9099</port>
                   </socket-address>
                </remote-addresses>
                   <connect-timeout>10s</connect-timeout>
                </tcp-initiator>
    Haven't configured load balancer on the proxy, so by default it should be set to 'proxy'. Have even tried by explicity configuring load balancer to 'proxy' bo luck.
    Certain times I see, which is perfect
         proxy 1 -- 1 client connection
         proxy 2 -- 2 client connection's
         proxy 3 -- 1 client connection
         proxy 4 -- 1 client connection
         proxy 5 -- 2 client connection's
         proxy 6 -- 1 client connection
    But I also see
         proxy 1 -- 1 client connection
         proxy 2 -- 3 client connection's
         proxy 3 -- 0 client connection
         proxy 4 -- 0 client connection
         proxy 5 -- 1 client connection
         proxy 6 -- 3 client connection's
    Any ideas to fix this would be appreciated.
    Thanks
    K

    Hi Venkat,
    Been monitoring RequestTotalCount, but I still think connections still imbalanced..
    Currently, I have 3 clients and 5 proxy nodes and i see
    Proxy node 1 ---  ConnectionCount=2, RequestTotalCount=25
    Proxy node 2 ---  ConnectionCount=0, RequestTotalCount=23
    Proxy node 3 ---  ConnectionCount=0, RequestTotalCount=4
    Proxy node 4 ---  ConnectionCount=0, RequestTotalCount=18
    Proxy node 5 ---  ConnectionCount=1, RequestTotalCount=19
    Would appreciate your clarification. Also, shound't client connections be balanced based on 'ConnectionCount' and other attributes like CPU usage, etc?
    Thanks
    K

  • How to make the client connect to the server at the command prompt?

    I found this code on IBM's website, it was a training session on servers and clients using java.
    The code compiles fine and the server seems to start up properly when I use java Server 5000. I think whats happening is the server is running and listening for a connection on port 5000.
    When I try to run the client I get the following error.
    Exception in thread "main" java.lang.NoSuchMethodError: main
    I see a start() method but no main. As far as I know, applications should all have main, it seems as if the person who wrote this kinda confused applets with application. Not that I would really know what happened.
    If you have time, could you tell me if there's an easy fix for this? I would love to have this client/server working if it isn't too much trouble. As I have looked all over the net for a free client/server applet that will actually let me see the java code and none of the free ones do allow getting to their source.
    Most of them allow you to customize them somewhat but also have built in advertising that can't be removed.
    This is the closest I have come to finding one that lets me look under the hood. But alas it doesn't work out of the box and I don't know what to do to fix it.
    Heres the code: Server:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class Server
      // The ServerSocket we'll use 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 {
        // All we have to do is listen
        listen( port );
      private void listen( int port ) throws IOException {
        // Create the ServerSocket
        ss = new ServerSocket( port );
        // Tell the world we're ready to go
        System.out.println( "Listening on "+ss );
        // Keep accepting connections forever
        while (true) {
          // Grab the next incoming connection
          Socket s = ss.accept();
          // Tell the world we've got it
          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 synchronize on this because another thread might be
        // calling removeConnection() and this would screw us up
        // as we tried to walk through the list
        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 ) {
        // Synchronize so we don't mess up sendToAll() while it walks
        // down the list of all output streamsa
        synchronized( outputStreams ) {
          // Tell the world
          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] );
        // Create a Server object, which will automatically begin
        // accepting connections.
        new Server( port );
    }CLIENT:
    import java.io.*;
    import java.net.*;
    public class ServerThread extends Thread
      // The Server that spawned us
      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();
            // ... tell the world ...
            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 does; tell the world!
          ie.printStackTrace();
        } finally {
          // The connection is closed for one reason or another,
          // so have the server dealing with it
          server.removeConnection( socket );
    }Thanks for your time.

    CLIENT:
    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 );
        // We want to 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 );
          // We got a connection!  Tell the world
          System.out.println( "connected to "+socket );
          // Let's grab the streams and create DataInput/Output streams
          // from them
          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 ); }
      // Gets 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 ); }
    import java.applet.*;
    import java.awt.*;
    import java.io.*;
    import java.net.*;
    public class ClientApplet extends Applet
      public void init() {
        String host = getParameter( "192.168.1.47" );
        int port = Integer.parseInt( getParameter( "5000" ) );
        setLayout( new BorderLayout() );
        add( "Center", new Client( host, port ) );
    }Sorry about that. Now when I run an html file with this applet I just get the x in the corner.
    Thanks for looking.

  • Finding the clients connected to a server

    Hai Friends,
    I am doing a project in grid computing. I have developed a socket program for the client and server side using java and multithreading.
    I want to know the number of clirnts connected at a particular period of time and also the IP addresses of the client.
    Can anyone please suggest us the code for doing that.

    Create an object that describes each client. Something like:
    public class Client
        private Socket socket;
        private WhatEver whatEverDataYouNeed;
        ...whatever methods you need...
    }When a client connects create one of those objects and store it in a suitable data structure, e.g. LinkedList. When a client disconnects remove from list.
    There should be a method in Socket that gives you the IP address, see the javadoc for Socket.

  • How many client connections will iMQ 2.0 handle?

    My main concern is what the number of concurrent client connections (in a single instance) iMQ
    can handle? This also depends on Hardware/Software configuration, JVM version (if it pure Java implementation), etc. But it also depends on Vendor implementation. For example FioranoMQ claims that can handling more than 5K concurrent client connections in a single instance of the FioranoMQ server without leading to any substantial performance degradation when a low number
    of clients are connected to the server.

    With proper tunning iMQ 2.0 can handle thousands of simultaneous connections.
    For example on a modest Sun system (Sun Ultra 60/2300 (2x300MHz) 512MB ram)
    We have run 4000 active connections without a problem. With more memory the
    system could have supported more.
    The iMQ FAQ gives some tuning guidelines for configuring the iMQ server
    (the broker) to handle large number of connections. I'm attaching the
    relevant excerpt (the online FAQ is a bit out of date).
    When I try to connect more than 500 clients to the Broker's JMS service, performance gets really poor. Is there a way to configure the
    Broker to handle more connections with better performance?
    Yes. By default the JMS service's thread pool is limited to 1000 threads. The Broker runs best when it can allocate two threads per
    connection. Once the thread pool limit is reached, threads are shared and performance decreases.
    The solution is to:
    1.Increase the thread pool limit for the JMS service so threads are not shared.
    2.Configure the broker's socket read timeout so read threads fully block.
    3.Configure the JVM to improve performance in highly threaded applications.
    4.And if you are running on Solaris and plan on going over ~1000 connections you will also need to:
    Increase the maximum number of open file descriptors per process.
    Step 1: Increase thread pool limit for JMS service
    Set the jmq.jms.max_threads property to be 2X the maximum number of connections you wish to support. For example if you want to
    support 1000 connections you will need to set the property to 2000. You can do this by adding the following line to
    $JMQ_VARHOME/stores/<broker instance name>/props/config.properties:
    jmq.jms.max_threads=2000
    Or by running jmqcmd:
    jmqcmd update svc -n jms -o maxThreads=2000
    Step 2: Configure the broker's socket read timeout
    Set the jmq.protocol.timeout to 0 to cause read threads to fully block in read. Do this by adding the following line to
    $JMQ_VARHOME/stores/<broker instance name>/props/config.properties :
    jmq.protocol.timeout=0
    Step 3: On Solaris pass additional parameters to the JVM
    If you are running the broker on Solaris you should pass the following parameters to the JVM:
    -Xss128k -Xconcurrentio
    The first parameter reduces the per-thread stack size to 128k. The second adjusts several internal JVM parameters that significantly improves performance of highly concurrent applications.
    You may pass these to the broker by using the -vmargs option to the broker command or you may choose to alter the $JMQ_HOME/bin/jmqbroker script by adding "-Xss128k -Xconcurrentio" to the line that starts with with "def_jvm_args". For example you would end up with a line that looks like:
    def_jvm_args="-Xms8m -Xmx128m -Xss128k -Xconcurrentio"
    Note that if your system has sufficient RAM you may also want to increase the JVM max heap size parameter (-Xmx128m).
    Step 4: On Solaris Increase the maximum number of open file descriptors per process
    This is covered in the iMQ 2.0 documentation. One way to do this is to run 'ulimit -n unlimited' in the shell you are going to run the broker in.

  • Sockets question (multiple user, client-server application)

    I'm new to sockets and I think I've been designing my application all wrong.
    I've been using the KKMultiServer example from this website. It creates new threads using the Socket.accept() function. However, all the clients connect to the same port on the server.
    What I'm creating is a multi-user TicTacToe program. So far it's only for two players, but I would like to create a game "lobby" where lots of users can connect and play games with each other.
    Do I need to specifcy local ports for the clients that are connecting? Should I be using different ports on the server for each user so the traffic doesn't get mixed up?

    a socket is made up of 4 elements.
    1) the server or host IP address
    2) the server port
    3) the client IP address
    4) the client port
    for a socket to be unqiue one of these elements must be different.
    to make these unique client sockets use a port assigned by the OS and so you can have more than one client connected to a server and 1 client machine can have more than 1 open socket.
    here is a print out from netstat (an IP utility on windows that shows some of my open sockets...
    Active Connections
    Proto Local Address Foreign Address State
    TCP CHEF2:1033 CHEF2:3306 ESTABLISHED
    TCP CHEF2:3306 CHEF2:1033 ESTABLISHED
    TCP CHEF2:3306 CHEF2:3626 ESTABLISHED
    TCP CHEF2:3306 CHEF2:3743 ESTABLISHED
    TCP CHEF2:3626 CHEF2:3306 ESTABLISHED
    TCP CHEF2:3743 CHEF2:3306 ESTABLISHED
    TCP CHEF2:1278 216.71.131.122:22 ESTABLISHED
    TCP CHEF2:1694 kw40.primenetwork.net:http CLOSE_WAIT
    TCP CHEF2:1863 67.72.120.62:http CLOSE_WAIT
    TCP CHEF2:1869 host16.ipowerweb.com:http TIME_WAIT
    TCP CHEF2:1870 host16.ipowerweb.com:http TIME_WAIT
    TCP CHEF2:1871 host16.ipowerweb.com:http TIME_WAIT
    TCP CHEF2:1872 host16.ipowerweb.com:http TIME_WAIT
    TCP CHEF2:1875 host16.ipowerweb.com:http TIME_WAIT
    TCP CHEF2:1881 host16.ipowerweb.com:http TIME_WAIT
    TCP CHEF2:1884 host16.ipowerweb.com:http TIME_WAIT
    TCP CHEF2:3623 216.71.131.122:ftp CLOSE_WAIT
    TCP CHEF2:3841 CARTMAN:netbios-ssn ESTABLISHED
    at any rate
    notice how on my machine (CHEF2) i have a service running on port 3306. i also have three sockets open from my machine acting as a client to the service. you can see it lists these three open sockets to my machine twice each.
    at any rate it can tell them all apart from the server end because the port used by the client is different.
    to sum up this and the answer given above you don't have to worry about it.

  • Finding IP of clients connected to a particular server

    Hi,
    How can we trace the IP of a client connected to the server and based on that deny access to a particular IP address?

    Did you really read the link? The query that is given there needs to be in a login trigger so the IP address is visible for each session in v$session.
    Yes, of course, if you just run that query at a SQL*Plus prompt, it will show you your IP address - that is the point.
    Once you can see the IP address in v$session, you can deny access to a specific IP in the login trigger.

  • Which ports to open in PIX for outgoing Cisco VPN client connections ?

    I have Cisco vpn clients behind the PIX and i want them to connect to a vpn 3005 which i behind another PIX . Can anybody tell me which ports i have to open on both the PIX firewalls ?

    It depends on how you have deployed your VPN Remote Access users.
    By default, if you enable IPSec-Over-TCP or IPSec-over-UDP, then port 10000 is used for both, these methods are Cisco Proprietary and can be changed.
    If you use NAT-T (NAT Traversal), the Standards-based implementation, then it uses UDP-4500).
    either way, the operation of the VPN depends on:
    1) Whether these service have been enable on the VPN Concentrator
    2) Enabling the relevant transport settings on the VPN Client connection Properties.
    Regarding the PIX infront of the VPNC3005, you will need to allow these above ports inbound to your VPNC3005 Public interface.
    Locally, it depends if you filter outbound connections through your PIX. If you don't, then the PIX will allow the connection for the VPN Client attempting to access the remote VPNC3005

  • Echo to all clients connected to NIO server

    I am writing a NIO xml socket server that uses NIO.
    My model implemensts a producer / consumer system where client connections are accepted and processed by a specified number of worker threads.
    I would like to be able to broadcast a message to all clients that are connected to the server.
    Opinions / suggestions I am sure that this is quite a common type of functionality.
    Kind Regards

    Accendia server is implementing a callback mechanism that allows the server to notify the client.
    This is not broadcast, you would have to call each client (www.accendia.com). For real broadcasting use datagram or multicast sockets (depends on different factors) on both client and server in addition to the sockets used as part of the NIO server.

  • Broadcast to all clients connected to NIO server

    I am writing a NIO xml socket server that uses NIO.
    My model implemensts a producer / consumer system where client connections are accepted and processed by a specified number of worker threads.
    I would like to be able to broadcast a message to all clients that are connected to the server.
    Opinions / suggestions I am sure that this is quite a common type of functionality.
    Kind Regards

    Accendia server allows the server side to invoke callback objects on the client. You can't do real broadcasting, though, you would have to iterate through all client connections. See if it helps:
    http://www.accendia.com
    If you need real broadcasting you can use datagram or multicast sockets on both the server and client side.

  • Blocking client connection, if server down

    Hi,
    is there a way for a client connection (an io socket, not by using nio channel) to block for a server, if the server is currently down?
    Thanks

    There's much more to this than the OP realizes:
    1) if the server is down before the client could establish a connection,
    the client has to keep retrying to make a connection.
    2) if the server goes down while the client was waiting/reading for some
    data, the connection is lost, the partial data must be kept or thrown
    away depending on the communication protocol and the client should
    repeat step 1) again.
    3) if the server goes down while the client was writing to the server, the
    write fails and the entire shebang should be restarted at step 1) again.
    Personally I wouldn't bother and simply spit out a "connection lost,
    please try again later" towards the general direction of the user.
    kind regards,
    Jos

  • Can a Snow Leopard client connect to a Lion Server?

    I have an XSAN setup with two Mac Mini servers.
    I have a few Xserve lying around and I want to make use of them.
    One Duo Core which is not working at the moment. I think I can install Lion on that one? Right?
    Then I have two G5 - none intel, which I'm thinking I'll reinstall Snow Leopard on and use them as clients.
    Can they connect to a Lion Server? I have a few XSAN licenses left which I think I need for OS's older than Lion?
    I short, can a Snow Leopard client connect to a Lion Server?

    One Duo Core which is not working at the moment. I think I can install Lion on that one? Right?
    You can't install Lion on a Core Duo-based system It requries Core2 Duo as a baseline. The Core Duo is a 32-bit chip whereas the Core2 Duo is 64-bit.
    Then I have two G5 - none intel, which I'm thinking I'll reinstall Snow Leopard on and use them as clients.
    Nope, again. Snow Leopard requires an Intel-based system. The highest you can go with the PowerPC machines is Leopard (10.5.x)
    Can they connect to a Lion Server? I have a few XSAN licenses left which I think I need for OS's older than Lion?
    This may be irrelevant given the above, but define 'connect' please. There are a myriad of ways of 'connecting' a client to a server. In many cases they don't have to be the same OS, platform, processor or anything else (how many web servers do you think are running Mac OS X to match your client?

  • Different client connect server but get same IP??

    i am doing a server for multiplayer game. when the client connect to server, server need to keep it IP. but why my server always get same IP for every connected client? my code is as below
    public class CommServer {
        private Vector clients = new Vector();  // a list of all connected clients
        ServerSocket server;   // the server
        private static int INTPORT=9999;
    public static void main(String args[]) {
            CommServer myCS = new CommServer(INTPORT);
       public CommServer(int port) {
            startServer(port);
       private void startServer(int port) {       
            try {
                // --- create a new server
                server = new ServerSocket(port);
                 // --- while the server is active...     
                while(true) {
                    // --- listen for new client connections
                    Socket socket = server.accept();
                    CSClient client = new CSClient(this, socket);
                    writeActivity(client.getIP() + " connected to the server.");
                    // --- start the client thread
                    client.start();
            } catch(IOException ioe) {
                writeActivity("Server Error...Stopping Server");
                // kill this server
                killServer();
    public class CSClient extends Thread {
        private Thread thrThis;         // client thread
        private Socket socket;          // socket for connection
        private CommServer server;
       protected BufferedReader in;    // captures incoming messages
        protected PrintWriter out;      // sends outgoing messages
    public CSClient(CommServer server, Socket socket) {
            this.server = server;
            this.socket = socket;
            this.ip = socket.getInetAddress().getHostAddress();
            // --- initialize the reader and writer
            try {
                in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                out = new PrintWriter(socket.getOutputStream(), true);
            } catch(IOException ioe) {
                          killClient();
    public String getIP() {
            return ip;
        }please help.. thanks

    hi, thanks for reply.
    yes, i am trying to connect from different macnine
    that have different IP address.
    how to check if it asign same external IP toclient?
    can it be configure to assign different IP?what he means is, if you run your server at location
    A, and all your clients from location B, with the
    internet in between, and a single router/switch
    serving internet connections to the clients at the B
    location, then the server at the A location will see
    the external IP of the site B router, not the
    individual IPs of the clients behind the router
    (since those IPs are only for internal network usage
    behind the router)
    in short, do you test with multiple clients from one
    internet connection? then it would be logical that
    they present the same IP to the server. The best (and
    most realistic) way to test would be with multiple
    clients from multiple locations / internet connectionsok.thanks.
    so is it possible for me to get the client machine ip but not the IP for the router? because i will hav multiple user from same location access the server at the same time.

  • SSLServerSocket that only accepts client connections from localhost

    My end goal is to create an SSLServerSocket that will only accept client connections requested by localhost.
    I've tried creating a new SocketPermission:
    p1 = new SocketPermission("localhost:1024-65535", "listen,connect,accept")I am able to add it to a custom Policy's PermissionCollection, but it doesn't seem to work. I believe SecurityManager.checkAccept() only checks the host's name and not the client's...
    This following code works and illustrates what I'm trying to achieve, but I'd like it to happen before the socket is actually accepted:
    SSLSocket socket = (SSLSocket)m_sslServerSocket.accept();
    Strintg clientIP = socket.getSession().getPeerHost();
    if( !clientIP.equals( "127.0.0.1" ) & !clientIP.equals( InetAddress.getLocalHost().getHostAddress() )
        // reject connection
    }Any help is appreciated.
    Edited by: misterE on Oct 24, 2007 10:46 PM

    I'm not clear whether you are doing this Permission thing on the server side or the client side, and/or whether you have a SecurityManager installed.
    If the server only has SocketPermission("localhost:...", "listen,connect,accept") it should only accept connections from localhost, not from B. So I don't know why the first scenario worked.
    If the server only has this SocketPermission with some other hostname, it shouldn't be able to listen at any port. So I don't know why the first scenario worked.
    Unless there is no security manager installed.
    You can run it with -Djava.security.debug=access,failure to see what permission checks are being executed.
    BTW because connections are accepted by the TCP stack before permission checking takes place, as described above, the client won't get a ConnectionException if the permission is refused at the server: it will get most probably a SocketConnection: connection reset by peer when writing to the server.

Maybe you are looking for

  • Creating a form

    I am trying to create a form where there are ten choices - a multiple choice question.  Depending on what answer is chosen, I may or may not need them to choose from an addition drop down box.  Is that possible?

  • Hai GURU 's plz help me in this Issue !

    Hi Guru ! Please let me know what is the difference between Subsequent Debit Note and the debit note. Thanks in advance GURU.

  • [solved] To display Processes which are not running from constant process

    i have constant processes prostat1,prostat2,prostat3,prosta4,prostat6,prostat8,prostat9 (6 processes) runs to support the application Now my problem is i want to display the process which is not running (from the above 6 processes) Thanks in advance

  • 10.3.9 and force quits

    hi have some probs on the beige with 2 hard drives running 10.3.9 when i force quit an application why does it still show in the task bar and is there anything i can do to kill them? it does not work when i kill it but then when i do i get the spinni

  • How do I see if my movies in my iTunes library has synced to my ipad

    How do I find synced movies from my iTunes library to my ipad3 ? And how do I view these movies?