Newbie question on a client-server application architecture

I did some stuff in Java for awhile now, but I have never drawn in the network part of this one. I followed the tutorial to Oracle and I searched some other resources on the web. I don't have a very specific question, but I would be grateful if someone could help me understand all this. My goal in this learning project is to make a server application that will accept an unspecified number of independent of a client application connections. I think that I get the basics of establishing a ServerSocket on the server, put in place the socket on the client, and then open the entry and outflow on both and start a data transfer.

Now, I think I'm stuck in a misunderstanding on this transfer. All of the examples I see seem to treat data transfers when the order who speaks on each side is already known, so you send something good after connection and that you set the other side of eligibility receive something after the connection, and everything works fine. If the order is not known, but I can't seem to understand the flow of the application logic.

Let's say that the server gets 3 connections of 3 customers and save these Socket objects in an ArrayList. Then client B asks something, and the server responds accordingly. Later, the server needs to say something to client B, then it sends information through its support and client B responds accordingly. How should I go about setting up something like that? I think I should put listeners but I can't find examples like these, or do I define the infinite loops for each socket, try to read the data?

Any help to guide me in the right direction would be much appreciated.

Think of a very basic chat client-server application. When a client connects, it receives all messages written by other customers. It can also send messages that will go to all other customers. It is very similar to your uncertainty about who will speak in the first place, the server or the client. If users wait a bit after the connection, it is likely, that the server will talk first (because another user sent a message). If the customer/user is fast, he'll talk first ("Hello World" or something like that). There are examples of these applications of simple chat on the web, just google for them. And Yes, this is usually achieved with infinite loops. Every customer will have a such loop, try to read data from the server and the server will have as many endless loops simultaneously assets (think multi-threading) given that the connected clients.

Tags: Java

Similar Questions

  • LabVIEW DSC Client\Server application. How to install the executable on the client.

    Hi all

    I'm currently programming an Client\Server application.  The server application must host shared variables, and the client application must read.  The client application reads the shared variable in the indicator of their connection with the properties of the indicator.  I started programming and the client application and the server are in the same project.  In the client application I am lie the indicator to the library in my project that has the "My Computer" as the address.  My question is how do I tell the executable installed on any computer, that I wanted to use the variables shared on the server?  I have LabVIEW 2009 DSC.

    Thank you

    If by "data binding", you hear the Variables defined on your computer, then Yes, unless you want not linked to new variables on each executable, in this case here is an example that can help.

  • client-server application

    I intend to transfer my application written in C/C++ for playbook... Basically, the application has a client and a server process communicating via sockets... Client process has a user interface with a few UI controls components, server process will run in the background... I would like to know if the client-server application can be written on the AIR platform?... If this support is available I think using AIR/native extension for C/C++ code porting

    Also, I'm new to this platform, I would like to know if there is a support to launch the 3rd party app to another 3rd party app?... Say to use above customer case must be able to launch the server process...

    concerning

    Arun

    Not too sure how you'll be able to do on the PB, because you can't start another application. Maybe in the future they will allow applications 'start-up' to be registered.

  • Client-server applications with problems

    We use appvolumes 2.10

    We are certain to have issues with client-server applications such as launch winscp and subversion.they very well, but they can not connect to servers. The appstacks work fine on own vanilla but does not work on the main image with all the policies and basic applications. When install us it manually on the main image the applications work as expected. Indications on where we can make changes on the primary image for the appstacks works? Thank you

    Lakshman thanks for you the directions. I tried to change the .cfg file last week, but had no luck. It's a known with Appsense AM incompatibility. We have uninstalled Appsense & h and it seems to have solved the problem.

  • Sync phone to PC Client/Server applications use what security group to access the files on PC Win 7

    Programs of client server that connects to the computer from a phone and store data on the PC as the synchronization programs have what user ID and are able to write to the disk by security group file permissions. Users authenticated Internet Explorer, system, administrators, customer ID current user appears on the phone and must be enabled (admin) and the password entered to connect.  If the customer is logged as administrator? How can there be two users with the same user id?  One by the PC and the other on the phone.  If the phone connects the PC as a user in this group what id permissions?

    Question 2: If I agree a technician to fix it to my PC and fix it, what is it connected as? and what group permissions is using?  How to protect against the connection later?

    Thank you

    This issue is beyond the scope of this site and must be placed on Technet or MSDN
  • Client Server application performance impact due to the strong issue of retransmission of TCP packets

    People,

    I'm having problem of performance of serious application with my vSphere environment where I deployed a couple of database SQL Server stand-alone VMs (4 x VM) to be used by some applications virtual computers servers (4 x stand alone VMs) running Oracle Forms (Java) servers. Users connect from their own workstation to various geographic locations in Asia, the data center is in Australia.

    User (150 users of workstations Win7) - RDP-TCP/3389-> Terminal Server VM pool (one of the 45 x VM available) -Oracle Forms app TCP/80-> Application Server HTTP -SQL Server TCP/1433-> SQL Server VM.

    Somehow, report of the team of the network there are some consistent event TCP retransmit the packet between the Application Server to the database, as well as between Terminal servers.

    the accident occurred in any type of scenario same ESXi host or even different ESXi

    Material:

    HP BL 465c G7/G8 blades on c7000 enclosure

    HP Virtual Connect modules

    Software:

    vSphere U1 5.1 for all blades HP running ESXi and VCenter server.

    All terminal Servers Server (RDSH) and the OS: Windows Server 2008 R2 SP1 STD.

    Database: SQL Server 2005 and 2008 R2

    What could cause the TCP retransmission on the virtual environment?

    wreedMH, what kind of problem you encounter on your server environment blade HP?

    What I did:

    1 perform the update firmware on blade HP, ANC and also updated the drivers of ESXi for last October 2015 using HP SPP.

    2. upgrade to the last update of VMware ESXi 5.1 3 b build number 2323236.

    3. switch to level the latest VMware tools v10.0.5 after having done both above.

    4. follow VMware KB: big packet loss at the OS level invited on the VMXNET3 vNIC in ESXi small buffers Rx = 8192 and Rx ring #1 size = 4096


    Hope that helps.

  • Newbie question (DispatchEvent can't main Application)

    Hello world

    I am trying to send an event from a component mxml (CompB) to interact with one another mxml component (CompA), and they both live on the Application (addChild) of the hand, but it does not seem to have reached the main Application.

    There is no mistakes or tricks...

    I think it could be a syntax error.

    Any direction would be greatly appreciated!

    Here is my code... (condensed to only show what is necessary)

    CompB:

    " < = xmlns:mx mx:Panel ' http://www.Adobe.com/2006/MXML "

    creationComplete = "creationCompleteHandler ()" >

    < mx:Script >

    <! [CDATA]

    private function creationCompleteHandler (): void {}

    videoDisplay.addEventListener (VideoEvent.COMPLETE, videoCompleteHandler);

    }

    public void videoCompleteHandler(event:VideoEvent):void {}

    dispatchEvent (new Event ('videoComplete'));

    }

    []] >

    < / mx:Script >

    < / mx:Panel >

    ------------------------------------------------------------------------------------------ -----

    Main application:

    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "

    Initialize = "init ()" >

    < mx:Script >

    <! [CDATA]

    import com.CompA;

    import com.CompB;

    private var myFancyCompA:CompA;

    private var myFancyCompB:CompB

    private function init (): void {}

    myFancyCompB.addEventListener ('videoComplete', completeHandler);

    addChild (myFancyCompB);

    }

    public void completeHandler(event:Event):void {}

    Alert.Show ("Success!");

    myFancyCompB.visible = false;

    }

    []] >

    < / mx:Script >

    < / mx:Application >

    When I run the application, and the video ends, no popup alert...

    I narrowed down it to the expedition or the listener.

    I feel that the event is not that they prepare properly.

    Thank you!!

    DK

    Your event dispatching component sends the event at the top of the hierarchy of the application.  If the parent is the application he will hear it.  If your component is buried a little further down bubbling (set to true) allows him to go up the hierarchy until you reach the next level.  You can stop it bubbling in some points using stopPropogation() or stopImmediatePropogation().

    However, can I still add to thid question HarUI, or someone else and ask why bubbles considered bad practice.  I've seen other applications do.  If you want to send an event at two levels, so to speak, you listen to so and re ship at each level.

    What is the best practice for this?

    Thank you very much.

  • Test the Client/Server application on device inside WiFi

    Hello

    I need to test my application within the company wifi network.

    My application survey exception I need to properly configure the APN.

    If I understand correctly it will route all traffic through external servers? In this case it will not help me.

    I saw on the form that you need to be a partner with RIM, so your applications will have easier access to netowrk. Anyone know how to make a claim for this? Thare are a lot of information on the website of RIM, but I havenot found place where to put my info.

    Thank you

    Alexander

    test your application inside the WIFI device should work without any problem

    Direct TCP will not work if you have not set the APN

    How do you connect? If you try to connect with deviceside = true and no APN settings it will fail

    with OS5, it's easy to configure your connections, allowed etc. TransportTypes.

    could be something like this:

    ConnectionFactory cf = new ConnectionFactory();
            cf.setPreferredTransportTypes(new int[]{
                TransportInfo.TRANSPORT_TCP_WIFI,
                TransportInfo.TRANSPORT_BIS_B,
                TransportInfo.TRANSPORT_TCP_CELLULAR,
                TransportInfo.TRANSPORT_WAP2});
            isBOptions biso = new BisBOptions(seekretConnectionType);
            cf.setTransportTypeOptions(TransportInfo.TRANSPORT_BIS_B, biso);
    ...
    ConnectionDescriptor connectionDescriptor = cf.getConnection(getMyURL());
            if (connectionDescriptor == null) {
                 reason = "no Connection could be made - please try later again";
                 logger.warn( reason);
            } else {
                logger.debug("current TransportType: "+TransportInfo.getTransportTypeName(
                                        connectionDescriptor.getTransportDescriptor().getTransportType()));
                conn = (HttpConnection) connectionDescriptor.getConnection();
    

    You can set the TransportType Options like BISB, WAP2...

    in your case affecting TCP_WIFI should work

  • Best practices for the application of client-server (Socket)

    I want to build a client-server application

    (1) getting started... client creates the connection to the server and keeps the reading of data from the server
    (2) server continues to send different messages
    (3) given the messages view (Async) client server must be changed

    I tried different finished cases against IllegalStateChangeException updating GUI

    So, what is the best way to do this?

    Please give an example of work.

    Thank you
    Vijay

    Published by: 844427 on January 12, 2012 12:15 AM

    Published by: 844427 on January 12, 2012 12:16

    Well, without testing your code, I can say that if you want to update the ObservableList in updateLobby, you must be sure that this happens on the thread of JavaFX, because only this thread is allowed to update the properties / observable (who are currently in an active scene graph).

    So, I would change the code in updateLobby to this:

      @Override
      public void updateLobby(LobbyListModel[] changes) {
          final String[] ar = new String[changes.length];
          for(int i=0;i!=null){System.out.println(changes[i].getName());ar[i] = changes[i].getName();}}
    
    Platform.runLater(new Runnable() {@Overridepublic void run() {ol.addAll(ar);}});}
    
    
    Good luck!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    
  • Client/server JavaFX, how FX can do server-side?

    So I am ultimately design a client/server application. Now, I'm curious to know how FX itself can do.

    I know that Java EE is the server side of the platform, while that for the client side (right or...?) so I was curious to know how FX fits inside, just like a RIA (Rich Internet Application).

    I have seen examples such as the application of DataApp that uses the resources of the ERA with JavaFX, so I'm curious to know how, if any, limitations exist for FX.


    The reason I ask is because I'm trying to know where to start with EE and there is so much information it is overwhelming, and I have no idea where to start. It seems that there are a ton of "JSR" for different tasks, and I don't know exactly what I need and that, so I'm really confused: (all.

    Any ideas of how I should go about it would be appreciated.

    Thank you

    ~ KZ

    Ignore the JSR for now.

    Follow the JavaEE tutorial.
    http://docs.Oracle.com/javaee/6/tutorial/doc/

    The answers to many of your questions will be clear to you when you've completed the tutorial.
    -----------------
    I also like the tutorials here (they are a little dated, but still topical for most as the core of JEE6 specifications that the tutorial relies on have been released 5 years ago and JEE7 has yet to be published).
    https://Schuchert.wikispaces.com/EJB+3+and+Java+Persistence+API
    ------------
    zonski has a targeted spring + javafx tutorial if you prefer to learn and to use spring than JEE (they are different technologies, which cover roughly the same functional game):
    http://www.zenjava.com/series/building-JEE-applications-in-JavaFX-2-0/
    -----------------
    JavaFX is a setting aside of client, so there is not a lot that you would do with it on the side server.
    ----------------

    It seems that there are a ton of "JSR" for different tasks, and I don't know exactly what I need and that, so I'm really confused all

    Nobody needs JEE, just use the pieces that you want that are a good target for any project you do - do not try to use everything at once.
    Many things can be learned and used on its own.

    Some relevant topics, perhaps (in the order I would consider them):

    Persistence: http://docs.oracle.com/javaee/6/tutorial/doc/bnbpy.html
    Java Servlet technology: http://docs.oracle.com/javaee/6/tutorial/doc/bnafd.html
    Web services JAX - RS: http://docs.oracle.com/javaee/6/tutorial/doc/giepu.html
    Contexts and Dependency Injection: http://docs.oracle.com/javaee/6/tutorial/doc/gjbnr.html
    Enterprise Beans: http://docs.oracle.com/javaee/6/tutorial/doc/bnblr.html

  • Need help on TCP/IP port multi Client-Server

    Hi all, I'm trying to develop a client-server application to disseminate data on a few numbers of random ports (defined by myself) to the data on the server TCP stream (IE another computer) in LabVIEW. So far, I created my app using the examples OR for 'Simple Client + Server data' and it works fine. I also understand that VI 'TCP Listen' could not listen to the TCP 1 connection only and a way around this is to use the idea of queues to receive & process the incoming data. The disadvantage of the idea is that the 'port' basic (IE original port) must be the same (on each client TCP) with the TCP server and it is not suitable for the use I have planned.

    Basically on the side of TCP server, I need to graph/control data on different port numbers that are currently broadcast in real time to client TCP one computer. Is this possible in LabVIEW?

    Anyone (gurus OR incl.) advise and point me in the right direction?

    * lost *.

    Hello

    http://zone.NI.com/DevZone/CDA/EPD/p/ID/2739 Here you can download this component. But you can also use the TCP icons which is available in the data communications > Protocals > TCp for communication and to read and write data using flattened string Variant. I have attached a small example where I'll copy a constant string to the PC to check the connection between the client and the host server. Hope this helps you.

  • Is it possible to Client/Server?

    Our photography club is looking for ways that we can ask our members using PS, LR and possibly items.  We would like to keep things simple, with only one copy of the software resides on our server and the possibility to attach up to eight or ten student computers.  Is this possible in the Adobe environment today?  Yes, I see the responses that say coming: subscribe to the cloud.  This is not what I'm trying to do.

    Thanks in advance for your help.

    Photoshop is not available as a client/server application. If it was to buy a volume for the 600 users license would be incredibly expensive. You can of course use a network for the storage of files. I'm afraid that your option here would be to have the members of the club to buy a subscription to the CC for $10 per month or as a club buy a teaching edition (but do not qualify for that) stand-alone versions are not good / educational editions. If you are interested there is a link below

    Pricing plans and creative Cloud membership | Adobe Creative Cloud

    A rough calculation would put your monthly costs at about £7000 per month, but with the purchase of 600 licenses, I'm sure that you get a discount of heavy, still £84 000 a year for a club won't be very convenient.

  • Consistency API solves all the problems of coherence Client/Server App.

    While working on consistency client/server applications, I hope that only the consistency API would be enough for the part coding mainly for the management of the caches.
    It is necessary to adopt some other APIs such as 'Spring AOP + Annontation' for the management of caches through webservices, pls?

    Edited by: online247 July 19, 2011 15:02

    Re: "I hope that only consistency API would be sufficient for the part coding mainly for the management of the caches.

    Yes.

    But hiding a lot more than simple 'management' (i.e. start then get / put.) You may want to use a larger section of the API to make "in place" data processing where he resides in fact (i.e. on the server side) using input processors, etc. etc. Same read/write of data from external sources, that is the basics. Good reading to the top of the dev Guide. What coherence do (some of them not even you force to actually encode anything via the API.)

    Re: "is it necessary to adopt some other APIs such as 'Spring AOP + Annontation' for the management of caches through webservices, pls?

    Well, only not for the 'management' of the caches. You tend to do more monitoring and management via JMX.

    But for 'access' caches...

    If you want a 'web services' interface on your registry caches, it's your call, how to go about it. I had good results with Apache CXF in the past, using the standard Java Web Service Annotations to the drive. The use of the spring and Spring AOP is yours. Consistency do respect, it's just a choice that you make about how you want to achieve the specific requirements of your project.

    See you soon,.

    Steve

  • Error: Failed Application path: C:\Program Files (x 86) \Trend Micro\Client Server Security Agent\HostedAgent\svcGenericHost.exe

    original title: genric hosted agent services

    Description

    The failing Application path: C:\Program Files (x 86) \Trend Micro\Client Server Security Agent\HostedAgent\svcGenericHost.exe

    Signature of the problem

    Problem event name: APPCRASH

    Application name: svcGenericHost.exe

    Application version: 3.5.0.1163

    Application timestamp: 4d9d3841

    Fault Module name: StackHash_0a9e

    Fault Module Version: 0.0.0.0

    Fault Module Timestamp: 00000000

    Exception code: c0000005

    Exception offset: 74676c9c

    OS version: 6.1.7601.2.1.0.768.3

    Locale ID: 1033

    Additional information 1: 0a9e

    More information 2: 0a9e372d3b4ad19135b953a78882e789

    Additional information 3: 0a9e

    Additional information 4: 0a9e372d3b4ad19135b953a78882e789

    Additional information about the problem

    Bucket ID: 2507689456

    Maybe you shouod check with Trendmicro support.

    http://eSupport.trendmicro.com/en-us/default.aspx

  • Another question on the appeal of a Web Form to a form of Client-Server

    Thanks to this forum, I was able to get my Client-Server (6i) form to call a Web Form and pass it a parameter. Unfortunately, this code displays the user name and password in the Internet Explorer address bar. Although not critical, I would like to delete the user name and password to be visible. I am able to do this in the Web form code below because it calls JavaScript that will hide the address bar - but the WEB. Function SHOW_DOCUMENT is not available in the form of Client-Server.

    So my question is whether it is possible to convert the code 'Customer Forms Server' below which is called my Web form using similar JavaScript functionality that is present in the 'Web Forms Code' example below? I want the server code to use the javascript functionality because I want to hide the address bar (which currently shows the users Username and Password).


    Code client server Forms (able to use when you call this a form of Client Server Web form):
    CL: = "cmd /c start iexplore.exe" http://9.35.32.205:7777/forms/frmservlet? " pageTitle = trial email Reporting & config = TTMSMENU & form=./forms_test/TrialMailReporting & otherparams = p_prospect = X 110679 & userid =' | the user | » /'|| GET_APPLICATION_PROPERTY (PASSWORD). » @' || : overall. DB_Instance |' » ' ;
    host (cl);

    Web Forms Code (able to use when you call this Web to another Web form form):
    WEB. SHOW_DOCUMENT ("JavaScript: void (window.open ("http://'|| ") ip_port | "/ forms/frmservlet? pageTitle = dropper E/M & config = TTMSMENU & form=./forms_test/TrialMailReporting & userid =' | the user | » /'|| GET_APPLICATION_PROPERTY (PASSWORD). » @' || : overall. (("DB_Instance |'", "", "resizable = Yes, location = no, Toolbar = no, MenuBar = no, Status = no,")); self. Close () ',' _blank');


    Any help would be greatly appreciated!

    Published by: Buechler on April 8, 2009 15:57

    Looks like Forms 6i PL/SQL version does not correctly convert to hex.
    That's what you can do:
    Create a db stored function

    CREATE OR REPLACE FUNCTION to_hex (p_string VARCHAR2)
       RETURN VARCHAR2
    IS
       v_hex   VARCHAR2 (1000);
    BEGIN
       FOR i IN 1 .. LENGTH (p_string)
       LOOP
          v_hex := v_hex|| '%' || LTRIM (TO_CHAR (ASCII (SUBSTR (p_string, i, 1)), 'XX'));
       END LOOP;
       RETURN v_hex;
    END;
    
    cl := 'cmd /c start iexplore.exe "http://9.35.32.205:7777/forms/frmservlet?pageTitle=Trial Mail Reporting&config=TTMSMENU&form=./forms_test/TrialMailReporting&otherparams=p_prospect=X110679&userid='||to_hex(v_conn)||'"';
    

Maybe you are looking for