Server multiplexing, ?nio?

Hi, I'm building gateway server that is processing request from 3rd party application and communicating with som wireless devices and transferring data in and out. Problem is that 3rd party software wants to communicate with every single device on a different port (there are app. 30 of them). I read something about nio classes and wanted to use selector but then realized it's just for sockets. Is there any way to manage a pool of server sockets so I wouldn't need to run 30 separate threads all the time for incomming data? I don't want to reinvent the wheel again.
Thanks for ideas.

I read something about nio classes and wanted to use selector but then realized it's just for socketsNo it's not. It's for any SelectableChannel. These include SocketChannel, DatagramChannel, and ServerSocketChannel. This is ideal for what you need.

Similar Messages

  • How to make a Simple NIO Scalable Server?

    I want to learn NIO for a project, but first want to start out simple. I want to figure out how to send a string across from clients to a server using NIO. I tried looking up stuff, but got caught in the terminology and such. How can I make a simple scalable server (agh tripple S) to send strings across? (like a chat server or something). All I know is I need to use a Selector and some Threaded loops to do stuff.
    I found http://gee.cs.oswego.edu/dl/cpjslides/nio.pdf and tweaked the code to make (what I thought was) a simple server, but I do not know how to make client code or even whether or not my Server code works.
    This is what I have so far:
    import java.io.*;
    import java.nio.*;
    import java.nio.channels.*;
    import java.nio.channels.spi.*;
    import java.net.*;
    import java.util.*;
    import static java.lang.System.*;
    public class NIOTest {
    public static void main(String args[]) throws Throwable
    try {
    new Thread(new NIOTestServer()).start();
    } catch(Exception e) {
    e.printStackTrace();       
    class NIOTestServer implements Runnable
    final Selector selector;
    final ServerSocketChannel serverSocket;
    int chatPort=9990;
    public NIOTestServer() throws Exception
    selector=Selector.open();
    serverSocket = ServerSocketChannel.open();
    serverSocket.socket().bind(
    new InetSocketAddress(chatPort));
    serverSocket.configureBlocking(false);
    SelectionKey sk =
    serverSocket.register(selector,
    SelectionKey.OP_ACCEPT);
    sk.attach(new Acceptor());
    public void run()
    try
    while(!Thread.interrupted())
    selector.select(); //Blocks until atleast one I/O event has occured
    Iterator<SelectionKey> it=selector.selectedKeys().iterator();
    while(it.hasNext())
    dispatch(it.next());
    catch(Throwable lol)
    lol.printStackTrace();
    void dispatch(SelectionKey k)
    Runnable r = (Runnable)(k.attachment());
    if (r != null)
    r.run();
    class Acceptor implements Runnable
    { // inner class to accept the event
    public void run()
    try
    SocketChannel c = serverSocket.accept();
    if (c != null)
    new Handler(selector, c);
    catch(IOException ex) {ex.printStackTrace();}
    import java.io.*;
    import java.nio.*;
    import java.nio.channels.*;
    import java.nio.channels.spi.*;
    import java.net.*;
    import java.util.*;
    import static java.lang.System.*;
    final class Handler implements Runnable {
    final SocketChannel socket;
    final SelectionKey sk;
    ByteBuffer input = ByteBuffer.allocate(1024);
    ByteBuffer output = ByteBuffer.allocate(1024);
    static final byte READING = 0, SENDING = 1;
    byte state = READING;
    Handler(Selector sel, SocketChannel c) throws IOException
    socket = c; c.configureBlocking(false); //makes it non blocking
    // Optionally try first read now
    sk = socket.register(sel, 0);
    sk.attach(this);
    sk.interestOps(SelectionKey.OP_READ);
    sel.wakeup();
    boolean inputIsComplete()
    return input.hasRemaining();
    boolean outputIsComplete()
    return output.hasRemaining();
    void process()
    CharBuffer buf=input.asCharBuffer();
    buf.flip();
    out.println(buf);
    public void run()
    try {
    if (state == READING) read();
    else if (state == SENDING) send();
    catch (IOException ex) { ex.printStackTrace(); }
    void read() throws IOException
    socket.read(input);
    if (inputIsComplete())
    process();
    state = SENDING;
    // Normally also do first write now
    sk.interestOps(SelectionKey.OP_WRITE);
    void send() throws IOException
    socket.write(output);
    if (outputIsComplete()) sk.cancel();
    }again this is a rough incomplete code test.

    See http://forum.java.sun.com/thread.jspa?forumID=536&threadID=5277053. You can use Telnet as a test client. When you come to write your own client, use java.net, not java.nio.

  • SSLSocket on client & NIO w/ SSLEngine on server

    Hi, I have a question about NIO & SSL...
    Does it make sense to use SSLSocket on the client-side to connect to a server, which uses NIO w/ SSLEngine?
    In my current code the server side is set up to be non-blocking. The handshaking part on the client side seems to work fine with the server's NIO & SSLEngine code, but after that it behaves oddly on the first read for application data (on the server-side). My SSLEngineResult from the unwrap of the first read has zero bytes for both produced and consumed. Not sure why...any thoughts?

    Thanks for the replies.
    I'm using the sample code that comes with the Java 5.0 SE. Although, I modified it a bit (the example is set up for an HTTP server).
    The read method looks like this:
    int read() throws IOException
            SSLEngineResult result;
            if (!initialHSComplete)
                throw new IllegalStateException();
            int pos = requestBB.position();
            if (sc.read(inNetBB) == -1)
                sslEngine.closeInbound();  // probably throws exception
                return -1;
            do
                resizeRequestBB();    // guarantees enough room for unwrap
                inNetBB.flip();
                result = sslEngine.unwrap(inNetBB, requestBB);
                inNetBB.compact();
                * Could check here for a renegotation, but we're only
                * doing a simple read/write, and won't have enough state
                * transitions to do a complete handshake, so ignore that
                * possibility.
                switch (result.getStatus())
                    case BUFFER_UNDERFLOW:
                    case OK:
                        if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK)
                            doTasks();
                        break;
                    default:
                        throw new IOException("sslEngine error during data read: " +
                                result.getStatus());
            } while ((inNetBB.position() != 0) &&
                    result.getStatus() != Status.BUFFER_UNDERFLOW);
            return (requestBB.position() - pos);
        }It returns from that method with the Status.BUFFER_UNDERFLOW.

  • Announcement: Java NIO Framework

    Hi all,
    After reading Ron Hitchen's book "Java NIO" and watching his presentation "How to Build a Scalable Multiplexed Server With NIO" at the 2006 JavaOne Conference, I implemented a framework based on his ideas.
    Here is the website: http://nioframework.sourceforge.net/
    I would be very glad if you could take a look and tell me what you think about it.
    Regards and thanks for your input!
    Ronny Standtke
    PS: I will add dukes to this topic and spend it for contributors (found bugs, hints, ...).

    Finally I found the time to write some benchmark programs for the NIO Framework and take a look at the MINA API.
    If you download the latest NIO Framework release you can run the plaintext benchmark as follows:
    Start the benchmark server (this is just the echo server without any session debugging output or logging) with the following command:
    java -cp nio_framework-0.9.3_all.jar ch.unifr.nio.framework.examples.BenchmarkServer 8080
    Then start the benchmark client with the follwing command:
    java -cp nio_framework-0.9.3_all.jar ch.unifr.nio.framework.examples.BenchmarkClient localhost 8080
    On my machine the resulting bandwidth is around 80 MB/s.
    And now to MINA:
    I used the very simple echo server example from the MINA project and just removed the logger from the chain. You may download this package from here (it includes all relevant source code):
    http://nioframework.sourceforge.net/mina_echo_server.jar
    You can start this server with the following command:
    java -jar mina_echo_server.jar
    If I run my BenchmarkClient against the MINA echo server the resulting bandwidth is only around 20 KB/s!? That is about 4000 times slower.
    Is MINA really THAT slow? I seriously doubt that. Are there any stops that I have to pull to get a higher bandwidth with MINA?

  • Java NIO question...

    Hey, I've just start reading and programming a client/server using NIO and got to a point where i need to keep a list of connected clients to send them messages as the server processes information it received... How could i handle this selection of clients that i want to send a specific message and how should I store those clients after they connect (I mean, when a client connects, a channel is started, but how can i identify later that a channel is related to THAT client?)
    Thanks in advance
    Message was edited by:
    Lemmerich

    Generally you will associate some kind of client session object with the channel via the attachment. This will also contain the input buffer and whatever you need in your application to identify the client.

  • Can I connect my application to mssql server

    Can I connect my application to mssql server ?

    nioe wrote:
    Something more specific, my search on Google does not appear something abuot mssql
    Perhaps you could help the process along by being a little more specific. Is this an in-house application. Will it ever leave your local network? Or does it need to run over the internet? Regardless, the best option will likely be some type of REST web service that any client can use.

  • Working with NIO and non-NIO sockets

    Hello,
    Trying to write a network manager kind of program where the client initiates a number of connections to different servers. Need to manage these connections through the life time of the session ( time the client is connected to the server). The client connections originate from a single machine, the servers are geographically distributed and about 1 to 5 connections between each client and server.
    I have tried and example NIO client/server application and it works fine. I have tried the KnockKnock client/server example it works. But when I try to use the NIO client with the multithreaded knockknock server, the socket connection goes through okay. However the data written to socket channel on the client(NIO) side doesn't seem to reach the server(non-NIO). I can't change the servers since they already exist in the field. I am just trying to write the manager application to manage them.
    Basically I am trying to avoid writing a multithreaded socket connection management program.
    Thanks for any input.

    Not the greatest NIO code. The author seems unaware that closing a channel also cancels all its selection keys so he laboriously programs both operations every time he needs to close the channel. His discussion of OP_CONNECT makes little sense: the important point is that OP_CONNECT is only used in the connection phase and OP_WRITE is only used in the connected phase.
    His code registers the channel for OP_WRITE as soon as the connection completes, when there is no pending data to write. This will just cause the selector to spin uselessly doing nothing. The channel should be registered with zero interest-ops and OP_WRITE should be registered when there is something to write, i.e. during the send() operation; and it should be deregistered when the write has completed successfully and there is no more data to write.

  • J2SE NIO vs J2EE

    We've created communication server using java nio socket where you can create clients of any language using socket to communicate to the server(java nio) application we made. The communication server can handle thousands of concurrent connected clients.
    My question is, is there a better way to create a communication server in J2EE that can handle thousands of concurrent connections?
    If there is, is there any advantage in doing so in terms of speed, scalability and functionality?
    Thanks in advance.

    georgemc is right. J2EE server can run on same JRE. However, some J2EE server will modifiy(or fine tune) the JRE for performance. Weblogic is one of the examples.
    I think a install package include everything may scare a beginner in Java. The J2EE server can increase the load of the OS.
    If you do not have the knowledge of J2EE, the error message of J2EE server(J2EE error+J2SE error) seems to be more difficult than the error come from J2SE.

  • Using nio And udp

    My first question is. If my server is using nio datagramchanels, my client must use it too?
    can i use traditional datagram socket for comunicate with a nio udp server?
    I have much information on nio and tcp with examples that work. but i can't find examples of communication between client and server using nio UDP. Some page of reference or tutorial?

    My first question is. If my server is using nio
    datagramchanels, my client must use it too?No.
    can i use traditional datagram socket for comunicate
    with a nio udp server?Yes.
    I have much information on nio and tcp with examples
    that work. but i can't find examples of
    communication between client and server using nio
    UDP. Some page of reference or tutorial?You haven't looked very hard. Try 'NIO UDP example' on google.

  • Sockets using NIO

    Hi all,
    I have a design question regarding socket architecture.
    I have written a server where there are certain services running. this is actually a socket server.
    Now i am writing a client.
    The challenge is the clients are many applets in one jsp page and all of them will essentially use one connection that is established to the server.
    So either we can make a basic applet which all others applets extend and use it.
    Can someone help with the code in java socket/nio to use and implement this kind of architecture?

    If the server uses NIO, there is not requirement for the client to do the same.
    Sharing code does not mean they will share the same connection, only that they will do it the same way. I would suggest you get it to work with individual connections and then optimise it to use a single connection.

  • LifeCycle DS ES communication with Tomcat WebServer

    Hi,
        I have written a simple program to accept Name using Flex SDK 3.2 HttpService in Flex builder 3. Using LifeCycle DS ES to communicate with struts 1.2 on Web Server(Tomcat 5.0). My flex code runs and Struts code runs independently. The problem is when trying to send data from client to Server, it does not work. Below given are my client ans Server side code. Copy of services-config.xml & proxy-config.xml is same on both client side and server side. Please help me to run this code.
    Client Side
    ========
    hello.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
    <![CDATA[
      public function hello1():void{
       HelloCall.send();
    ]]>
    </mx:Script>
    <mx:HTTPService id= "HelloCall" destination= "myHello">
        <mx:request xmlns= " ">
                <name>  {nameInput.text}</name>
        </mx:request>
    </mx:HTTPService>
    <mx:Label x= "312" y= "47" text= "Enter Name" fontSize= "20" />
    <mx:TextInput id= "nameInput" x="260" y= "104" fontSize= "20" />
    <mx:Button x= "301" y= "186" label= "Submit" fontSize= "20" click= "hello1();" />
    <mx:Label x= "312" y= "285" text= "{HelloCall.lastResult.jlc.message}" fontSize= "20" />
    </mx:Application>
    Server-Side
    ============
    proxy-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <service id="proxy-service"
        class="flex.messaging.services.HTTPProxyService">
        <properties>
            <connection-manager>
                <max-total-connections>100</max-total-connections>
                <default-max-connections-per-host>2</default-max-connections-per-host>
            </connection-manager>
            <allow-lax-ssl>true</allow-lax-ssl>
        </properties>
        <adapters>
            <adapter-definition id="http-proxy" class="flex.messaging.services.http.HTTPProxyAdapter" default="true"/>
            <adapter-definition id="soap-proxy" class="flex.messaging.services.http.SOAPProxyAdapter"/>
        </adapters>
        <default-channels>
            <channel ref="my-http"/>
            <channel ref="my-amf"/>
        </default-channels>
    <destination id="myHello">
        <properties>
             <url>/http://localhost:8000/JLCAPP/hello.jsp</url>
        </properties>
    </destination>
    </service>
    struts-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
    <struts-config> 
      <form-beans>
           <form-bean name= "helloForm" type= "org.apache.struts.action.DynaActionForm">
                  <form-property name= "name" type="java.lang.String" />
           </form-bean>
       </form-beans>
      <global-forwards>
      <forward name= "success" path= "/index.jsp" />
      </global-forwards>
    <action-mappings>
        <action path= "/hello" name= "helloForm" type="com.jlcindia.struts.HelloAction" input= "/hello.html" />
    </action-mappings>
      <message-resources parameter="com.jlcindia.struts.ApplicationResources" />
    </struts-config>
    services-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <services-config>
        <services>
            <service-include file-path="remoting-config.xml" />
            <service-include file-path="proxy-config.xml" />
            <service-include file-path="messaging-config.xml" />
            <service-include file-path="data-management-config.xml" />
            <service class="fiber.data.services.ModelDeploymentService" id="model-deploy-service" />
            <!--
         Application level default channels. Application level default channels are
         necessary when a dynamic destination is being used by a service component
         and no ChannelSet has been defined for the service component. In that case,
         application level default channels will be used to contact the destination.
            -->  
            <default-channels>
               <channel ref="my-rtmp"/>
            </default-channels>
        </services>
        <security>
      <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>       
            <!-- Uncomment the correct app server
            <login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/>
            <login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/>
            <login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/>
            -->
            <security-constraint id="basic-read-access">
                <auth-method>Basic</auth-method>
                <roles>
                    <role>guests</role>
                    <role>accountants</role>
                    <role>employees</role>
                    <role>managers</role>
                </roles>
            </security-constraint>
        </security>
        <!-- Socket servers that NIO endpoints all share -->
        <servers>
            <server id="my-nio-server" class="flex.messaging.socketserver.SocketServer">
            </server>
            <!--
            <server id="secure-nio-server" class="flex.messaging.socketserver.SocketServer">
                <properties>
                    <keystore-file>{context.root}/WEB-INF/flex/localhost.keystore</keystore-file>
                    <keystore-password>changeit</keystore-password>
                </properties>
            </server>
            -->
        </servers>
        <channels>
            <!-- Servlet Based endpoints -->
            <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
                <endpoint url="http://localhost:8400/JLCAPP/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
                <properties>
                    <polling-enabled>false</polling-enabled>
                </properties>
            </channel-definition>
            <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
                <endpoint url="http://localhost:8400/JLCAPP/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
                <properties>
                    <polling-enabled>true</polling-enabled>
                    <polling-interval-seconds>8</polling-interval-seconds>
                </properties>
            </channel-definition>
            <channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel">
                <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
            </channel-definition>
            <!-- Secure Servlet-based endpoints -->
            <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
                <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
                <properties>
                    <!--HTTPS requests on some browsers do not work when pragma "no-cache" are set-->
                    <add-no-cache-headers>false</add-no-cache-headers>
                </properties>
            </channel-definition>
            <channel-definition id="my-secure-http" class="mx.messaging.channels.SecureHTTPChannel">
                <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/>
                <properties>
                 <!--HTTPS requests on some browsers do not work when pragma "no-cache" are set-->
                    <add-no-cache-headers>false</add-no-cache-headers>
                </properties>
            </channel-definition>
            <!-- NIO based endpoints -->
            <channel-definition id="my-rtmp" class="mx.messaging.channels.RTMPChannel">
                <endpoint url="rtmp://{server.name}:2048" class="flex.messaging.endpoints.RTMPEndpoint"/>
                <properties>
                    <idle-timeout-minutes>20</idle-timeout-minutes>
                    <!-- for deployment on WebSphere, must be mapped to a WorkManager available in the web application's jndi context.
                    <websphere-workmanager-jndi-name>java:comp/env/wm/MessagingWorkManager</websphere-workman ager-jndi-name>
                    -->
                </properties>
            </channel-definition>
            <channel-definition id="my-nio-amf" class="mx.messaging.channels.AMFChannel">
                <endpoint url="http://{server.name}:2888/nioamf" class="flex.messaging.endpoints.NIOAMFEndpoint"/>
                <server ref="my-nio-server"/>
                <properties>
                    <polling-enabled>false</polling-enabled>
                </properties>
            </channel-definition>
            <channel-definition id="my-nio-amf-poll" class="mx.messaging.channels.AMFChannel">
                <endpoint url="http://{server.name}:2888/nioamfpoll" class="flex.messaging.endpoints.NIOAMFEndpoint"/>
                <server ref="my-nio-server"/>
                <properties>
                    <polling-enabled>true</polling-enabled>
                    <polling-interval-millis>3000</polling-interval-millis>
                </properties>
            </channel-definition>
            <channel-definition id="my-nio-http" class="mx.messaging.channels.HTTPChannel">
                <endpoint url="http://{server.name}:2888/niohttp" class="flex.messaging.endpoints.NIOHTTPEndpoint"/>
                <server ref="my-nio-server"/>
                <properties>
                    <polling-enabled>false</polling-enabled>
                </properties>
            </channel-definition>
            <!-- Secure NIO based endpoints -->
            <!--
            <channel-definition id="secure-nio-amf" class="mx.messaging.channels.SecureAMFChannel">
                <endpoint url="https://{server.name}:2443/securenioamf" class="flex.messaging.endpoints.SecureNIOAMFEndpoint"/>
                <server ref="secure-nio-server"/>
                <properties>
                    <polling-enabled>false</polling-enabled>
                </properties>
            </channel-definition>
            <channel-definition id="secure-nio-http" class="mx.messaging.channels.SecureHTTPChannel">
                <endpoint url="https://{server.name}:2443/secureniohttp" class="flex.messaging.endpoints.SecureNIOHTTPEndpoint"/>
                <server ref="secure-nio-server"/>
                <properties>
                    <polling-enabled>false</polling-enabled>
                </properties>
            </channel-definition>
            -->
        </channels>
        <logging>
            <target class="flex.messaging.log.ConsoleTarget" level="Debug">
                <properties>
                    <prefix>[LCDS] </prefix>
                    <includeDate>false</includeDate>
                    <includeTime>false</includeTime>
                    <includeLevel>false</includeLevel>
                    <includeCategory>false</includeCategory>
                </properties>
                <filters>
                    <pattern>Endpoint.*</pattern>
                    <pattern>Service.*</pattern>
                    <pattern>Configuration</pattern>
                    <pattern>SocketServer.*</pattern>
                </filters>
            </target>
        </logging>
        <system>
            <redeploy>
                <enabled>true</enabled>
                <watch-interval>20</watch-interval>
                <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file>
                <watch-file>{context.root}/WEB-INF/flex/proxy-config.xml</watch-file>
                <watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file>
                <watch-file>{context.root}/WEB-INF/flex/messaging-config.xml</watch-file>
                <watch-file>{context.root}/WEB-INF/flex/data-management-config.xml</watch-file>
                <touch-file>{context.root}/WEB-INF/web.xml</touch-file>
            </redeploy>
        </system>
    </services-config>
    HelloAction.java
    package com.jlcindia.struts;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.*;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.DynaActionForm;
    import java.io.PrintWriter;
    public class HelloAction extends Action{
    public ActionForward execute(ActionMapping am,ActionForm af,HttpServletRequest req,HttpServletResponse res) throws Exception {
        System.out.println("Hi am here");
        DynaActionForm daf= (DynaActionForm)af;
        String name= daf.get("name").toString();
        String msg= "Hello!"+ name + "Welcome to JLC FLex LCDS with HttpService";
        res.setContentType("text/html");
        PrintWriter out= res.getWriter();
        out.println("<message>" + msg + "</message>");
        out.close();
        return am.findForward("success");
    Any Help will be appriciated.

    Hi Rohit,
    I am running both LiveCycle DS ES 3.0 and WebServer Tomcat on the same machine. I made changes in services-congig.xml and now the channels are configured as follows on both client end and server end :-
    services-config.xml
       <!-- Servlet Based endpoints -->
            <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
                <endpoint url="http://localhost:8000/JLCAPP/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
                <properties>
                    <polling-enabled>false</polling-enabled>
                </properties>
            </channel-definition>
            <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
                <endpoint url="http://localhost:8000/JLCAPP/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
                <properties>
                    <polling-enabled>true</polling-enabled>
                    <polling-interval-seconds>8</polling-interval-seconds>
                </properties>
            </channel-definition>
            <channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel">
                <endpoint url="http://localhost:8000/JLCAPP/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
            </channel-definition>
    However i am still getting following debug message :-
    [RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url:
    'http://localhost:8000/JLCAPP/messagebroker/amf'"]
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[C:\autobuild\3.2.0
    \frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:220]
    at mx.rpc::Responder/fault()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder .as:53]
    at mx.rpc::AsyncRequest/fault()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncR equest.as:103]
    at mx.messaging::ChannelSet/faultPendingSends()[C:\autobuild\3.2.0\frameworks\projects\rpc\s rc\mx\messaging\ChannelSet.as:1482]
    at mx.messaging::ChannelSet/channelFaultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc \src\mx\messaging\ChannelSet.as:975]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.messaging::Channel/connectFailed()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\m essaging\Channel.as:997]
    at mx.messaging.channels::PollingChannel/connectFailed()[C:\autobuild\3.2.0\frameworks\proje cts\rpc\src\mx\messaging\channels\PollingChannel.as:354]
    at mx.messaging.channels::AMFChannel/statusHandler()[C:\autobuild\3.2.0\frameworks\projects\ rpc\src\mx\messaging\channels\AMFChannel.as:390]
    My current hello.jsp code is given below :-
    hello.jsp
    <%@ taglib uri= "/WEB-INF/struts-html.tld" prefix="html" %>
    <html>
    <body>
    <br> <html:form action="/hello.do">
    <h1> Name :  </h1><br/>
    <html:text property ="name" /><br/>
    <html:submit value= "Show" /> <br/>
    </html:form>
    </body>
    </html>
    Is hello.jsp required at server end, as URL specified in proxy-config.xml should directly invoke Action class in my Tomcat WebServer?
    My WebServer Tomcat Server log shows following :-
    [LCDS]Adobe LiveCycle Data Services: 3.0.0.254255
    [LCDS]Server 'my-nio-server' of type 'flex.messaging.socketserver.SocketServer' created.
    [LCDS]Endpoint 'my-nio-amf-poll' created with security: None
    at URL: http://localhost:2888/nioamfpoll
    [LCDS]Endpoint 'my-rtmp' created with security: None
    at URL: rtmp://localhost:2048
    [LCDS]Endpoint 'my-http' created with security: None
    at URL: http://localhost:8000/JLCAPP/messagebroker/http
    [LCDS]Endpoint 'my-polling-amf' created with security: None
    at URL: http://localhost:8000/JLCAPP/messagebroker/amfpolling
    [LCDS]Endpoint 'my-nio-http' created with security: None
    at URL: http://localhost:2888/niohttp
    [LCDS]Endpoint 'my-amf' created with security: None
    at URL: http://localhost:8000/JLCAPP/messagebroker/amf
    [LCDS]Endpoint 'my-nio-amf' created with security: None
    at URL: http://localhost:2888/nioamf
    [LCDS]Endpoint 'my-secure-http' created with security: None
    at URL: https://{server.name}:{server.port}/{context.root}/messagebroker/httpsecure
    [LCDS]Endpoint 'my-secure-amf' created with security: None
    at URL: https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure
    [LCDS]MessageBroker id: __default__ classLoader is: the MessageBroker's class loader and the context class loader (classLoader hashCode: 31966667 (parent hashCode:
    7043360 (parent system))
    [LCDS]Starting Adobe LiveCycle Data Services: 3.0.0.254255 Developer License
    [LCDS]NIOAMFEndpoint 'my-nio-amf-poll' has started and is using server 'my-nio-server'.
    [LCDS]SocketServer 'my-rtmp-SocketServer' is starting.
    [LCDS]SocketServer 'my-rtmp-SocketServer' is using an assigned executor of type: flex.messaging.util.concurrent.DefaultThreadPoolExecutor
    [LCDS]SocketServer 'my-rtmp-SocketServer' has determined the default thread priority for its executor to be 5.
    [LCDS]Reactor 'Reactor1' for SocketServer 'my-rtmp-SocketServer' is starting.
    [LCDS]Reactor 'Reactor1' for SocketServer 'my-rtmp-SocketServer' has started and is running at priority 5.
    [LCDS]Reactor 'Reactor2' for SocketServer 'my-rtmp-SocketServer' is starting.
    [LCDS]Reactor 'Reactor2' for SocketServer 'my-rtmp-SocketServer' has started and is running at priority 5.
    [LCDS]Acceptor 'Acceptor1' for SocketServer 'my-rtmp-SocketServer' is starting.
    [LCDS]Acceptor 'Acceptor1' for SocketServer 'my-rtmp-SocketServer' has successfully bound '/0.0.0.0:2048' to accept new client connections.
    [LCDS]Acceptor 'Acceptor1' for SocketServer 'my-rtmp-SocketServer' has started and is running at priority 5.
    [LCDS]SocketServer 'my-rtmp-SocketServer' has started.
    [LCDS]NIOHTTPEndpoint 'my-nio-http' has started and is using server 'my-nio-server'.
    [LCDS]NIOAMFEndpoint 'my-nio-amf' has started and is using server 'my-nio-server'.
    [LCDS]SocketServer 'my-nio-server' is starting.
    [LCDS]SocketServer 'my-nio-server' is using an assigned executor of type: flex.messaging.util.concurrent.DefaultThreadPoolExecutor
    [LCDS]SocketServer 'my-nio-server' has determined the default thread priority for its executor to be 5.
    [LCDS]Reactor 'Reactor1' for SocketServer 'my-nio-server' is starting.
    [LCDS]Reactor 'Reactor1' for SocketServer 'my-nio-server' has started and is running at priority 5.
    [LCDS]Reactor 'Reactor2' for SocketServer 'my-nio-server' is starting.
    [LCDS]Reactor 'Reactor2' for SocketServer 'my-nio-server' has started and is running at priority 5.
    [LCDS]Acceptor 'Acceptor1' for SocketServer 'my-nio-server' is starting.
    [LCDS]Acceptor 'Acceptor1' for SocketServer 'my-nio-server' has successfully bound '/0.0.0.0:2888' to accept new client connections.
    [LCDS]Acceptor 'Acceptor1' for SocketServer 'my-nio-server' has started and is running at priority 5.
    [LCDS]SocketServer 'my-nio-server' has started.
    See if this picks the point of failure!!

  • Persistent HTTP Requests in BSP: Can you Flush the Response without Ending It?

    Hello all,
    I have been looking for a way to implement a persistent HTTP Request in a BSP.  This means the server keeps the request open as long as possible and sends data periodically to the browser without closing the request.  In other development environments, there would be a way to flush the response to the client, separate from closing the connection, thus making this possible.  I have looked and do not see any way to do this.
    Also, if it is not possible with a BSP, is there another way to do this via the Web Application Server?
    Thanks for any help,
    -Chris

    There are various limits: the number of sockets / file descriptors that the operating system lets a program have open, the amount of socket buffer space in the operating system, the number of simultaneous connections that the web server allows. Each of these can be configured.
    One problem is that a web server starts a thread for each hit. If you have 1000 simultaneous active hits you have 1000 threads. That is quite a lot. I've seen server OSes start buckling at around 400-500 threads. Given a suitable OS you may get higher with a bit of configuration, but I'd say the number of threads is rather a big concern. 100,000 threads? That dog don't hunt.
    An alternative would be not to use a regular web server, but to use a NIO select -based server. Then you can have one thread that handles all the connections. I once did that to write a stock ticker applet. But if you want to do fully standards compliant HTTP implementation that's not trivial.
    If you are writing the client applet as well as the server, consider using a simpler protocol than HTTP and writing a NIO server. NIO isn't quite trivial to get really right; look at examples and tutorials; google is your friend. If you can keep each client's connection open do so; establishing and tearing down hundreds or thousands of connections a second, and sending HTTP request and reply headers, is going to eat network and CPU resources.
    If you are really targeting 100,000 clients at 5 seconds between messages, that comes to 20,000 messages per second. That's a lot; plan for a load balanced server cluster.

  • Maximum JMS Connections

              Hi,
              I would like to know what is the maximum JMS connections weblogic server can
              handle anytime. And where do we set this parameter? we have a group of Message
              Listeners listening to a Queue on weblogic by opening JMS connections at the same
              time. So I was wondering how many JMS clients can Weblogic handle?? And also does
              it impact the performance of weblgic server.
              Thanx,
              Sankas
              

              Thanks for the information guys. It was very helful.
              -Sankas
              Tom Barnes <[email protected]> wrote:
              >Each remote JVM to the WL server multiplexes network calls over a single
              >socket
              >connection, and each remote JVM may have many JMSConnections into the
              >WL server. A
              >single server can support thousands of remote JVMs, and tens of thousands
              >of
              >JMSConnections -- even with the default thread-pool sizes. Clustering
              >and
              >distributed destinations can help one scale higher. Of course, performance
              >and
              >scalability are highly application and hardware dependent, and the best
              >thing to do
              >is create a benchmark that emulates your particular apps characteristics
              >and see
              >how it scales...
              >
              >Tom, BEA
              >
              >Sankas wrote:
              >
              >> Shean,
              >> I did not have anything in mind. But if you see the weblogic console
              >there
              >> is a default parameter "JMS Thread Pool Size = 15" under the Server
              >section in
              >> the services/JMS Tab .
              >> I thought this was the JMSConnections count in the server.
              >> Well I think it would be good to know how far can we go
              >> with the JMS connections thing.
              >>
              >> Thanx,
              >> Sankas
              >>
              >> "Shean-Guang Chang" <[email protected]> wrote:
              >> > It will depend on the memory resource you used for the JVM (both
              >WLS
              >> >server
              >> >and client). There is no design limit for this. Do you have a number
              >> >in
              >> >mind?
              >> >"Sankas" <[email protected]> wrote in message
              >> >news:[email protected]...
              >> >>
              >> >> Hi,
              >> >> I would like to know what is the maximum JMS connections weblogic
              >> >server can
              >> >> handle anytime. And where do we set this parameter? we have a group
              >> >of
              >> >Message
              >> >> Listeners listening to a Queue on weblogic by opening JMS connections
              >> >at
              >> >the same
              >> >> time. So I was wondering how many JMS clients can Weblogic handle??
              >> >And
              >> >also does
              >> >> it impact the performance of weblgic server.
              >> >>
              >> >> Thanx,
              >> >> Sankas
              >> >
              >> >
              >
              

  • Cannot fee SSLEngine partial packets????

    I tried a test today where I took the first encrypted packet from a client SSLEngine and passed the first 10 bytes(out of 100) to a server SSLEngine. It resulted in the below exception. I more expected a buffer underflow....when I pass all 100 bytes, it works fine. Test should be easy for anyone to reproduce(though you need a trusstore, keystore, etc.) What is going on here? If I am doing tcp, and my packets get cut in half goinig out or coming in, am I screwed...will I have to tack a header/trailer on every ssl packet......does ssl do that??? I didn't think so? How do I know write something that talks to an ssh server with nio? Is it impossible?
    thanks,
    dean
    java.lang.RuntimeException: [serverAsynch] exception
         at biz.xsoftware.impl.nio.secure.engine2.AsynchSSLEngineImpl.feedEncryptedPacket(AsynchSSLEngineImpl.java:48)
         at biz.xsoftware.impl.nio.secure.test.TestAsynchSSLEngine.testHalfPackets(TestAsynchSSLEngine.java:117)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at junit.framework.TestCase.runTest(TestCase.java:165)
         at junit.framework.TestCase.runBare(TestCase.java:130)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:120)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
         at com.sun.net.ssl.internal.ssl.EngineInputRecord.bytesInCompletePacket(EngineInputRecord.java:152)
         at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:759)
         at com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:674)
         at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:566)
         at biz.xsoftware.impl.nio.secure.engine2.AsynchSSLEngineImpl.incomingDataImpl(AsynchSSLEngineImpl.java:102)
         at biz.xsoftware.impl.nio.secure.engine2.AsynchSSLEngineImpl.feedEncryptedPacket(AsynchSSLEngineImpl.java:46)
         ... 14 more

    yeah, it was not too clear, but the exception above is chained.....look at the last exception.....
    Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
    at com.sun.net.ssl.internal.ssl.EngineInputRecord.bytesInCompletePacket(EngineInpu tRecord.java:152)
    at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:759 )
    at com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:674)
    at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:566)
    at biz.xsoftware.impl.nio.secure.engine2.AsynchSSLEngineImpl.incomingDataImpl(Asyn chSSLEngineImpl.java:102)
    at biz.xsoftware.impl.nio.secure.engine2.AsynchSSLEngineImpl.feedEncryptedPacket(A synchSSLEngineImpl.java:46)
    ... 14 more

  • Maximum blaze users for my app?

    What exactly does it mean when adobe says Blaze will support "hundreds of clients per CPU"? I am thinking about using Blaze with polling. Does this mean that only a few hundred clients can use the app at once? We would have at minimum 5,000 clients using the app at once....as long as only a few hundred of that 5,000 are polling at once I should be fine, right? no?

    You are thinking in the right direction. I am tempted to say, sure, your application can support 5000 concurrent users, but every application is different - recommend performance testing to be sure.
    BlazeDS has no secret lock to reduce the number of users it can handle - it's purely based on the hardware limiations and software configurations. There are some fundamental differences between BlazeDS and LiveCyle Data Services (LCDS) you should be aware of:
    1. All connection between BlazeDS and the Flex client is through a Servlet, and is usally a blocking connection. This should not be a problem if you use polling. LCDS on the otherhand support an NIO (based on Java new IO API's) server. NIO connections are non blocking - they only block a thread when the client making the connection is active. This difference is important when you use streaming (server push) than polling.
    2. In addition, only LCDS supports RTMP (Real Time Messaging Protocol). You should look up to understand this protocol to determine if this is relevant for your application
    Hope this answers your question.
    -Anil.

Maybe you are looking for

  • Adobe flash player when on yahoo messenger for the web

    I don't know if anyone else using the new version on the adobe flash player on yahoo messenger for the web. But it keeps on locking up and sometimes it cause internet explorer to lockup and crash. anyone out there having this as well. This sucks. Whe

  • Fitting a Blu-Ray drive - problem

    I can't unscrew the two screws at the foot of the memory bay in order to remove the other items necessary for connecting the BD drive with properly routed cables.   I'm toying with the idea of cutting out a small part of the fan housing situated unde

  • Can PB can calcute the bounding box as the needed region in AE?

    Hi, I wrote many small pixel bender that I use mainly in AE. However I need them to be as efficient as possible, so I wonder if Pixel Bender can obtain the bounding box of an image input as the needed region. This way, it will not calculate an entire

  • HIDE STATEMENT IS MUST OR NOT FOR INTERACTIVE REPORT

    HI,   IN Interactive Report : without using the hide statement we will made the interactive report? and hide statement do its job after every increase of the sy-lsind please explain..          thanks            margani

  • Firefox does not show pdf form

    Installed Firefox 12.0 - Sys iMac G5 OS10.6.8. When trying to open a pdf file only a blank shows up. Under preferences -> Applications -> Content Type I do not have the Preview.app Document (application/pdf) showing so I cannot choose Adobe Reader???