Problem client/server with GUI

I have a problem with a project im working on. I have a main method that has an infinite loop but before it enters the loop, i draw the GUI. I put a simple print statement and found that it goes through the loop once. Can someone help me to figure out why the file does not send. I tried running this code without the GUI and the file sends.
here is the code:
public static void main(String[] args) {
          final String PATH = "/home/dford/Desktop/";
          ClientGUI display = new ClientGUI();
               Download[] download = new Download[5];
               int downloadIndex = 0;
               ServerSocket welcomeSocket = new ServerSocket(9876);
                         Socket connectionSocket = welcomeSocket.accept();
                         if(downloadIndex < 5)
                              download[downloadIndex++] = new Download(connectionSocket,
                                                                                 PATH + "snake.c");
                    catch(Exception e){}
                    System.out.println("Got here");
                    for(int i=0; i<downloadIndex; i++){
          catch(Exception e){
     }**And im trieing not to use Threads, but if i have to please let me know.
Edited by: dford425 on Mar 18, 2008 8:03 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

nevermind, i figured it out

Similar Messages

  • Client-Server side GUI programming

    I want to create a client-server side gui programming with java
    i read this web adress
    for information but there are some parts that i didnt understand and wait for your help
    i m trying to build an online-help(live chat) system so when people press the start chat button a java page will appear but i wonder how this will connect to the person who is on server side
    i mean is it possible to 2 users connect the same port and chat with each other
    I mean when user press the chat button the online help supporter will be informed somebody wants to speak with him and they will start a chat
    how can i do something like that
    any help would be usefull thanks

    Below is an example of a client/server program.
    It shows how the server listens for multiple clients.
    * Created on May 12, 2005
    package server;
    * @author johnz
    import java.util.Random;
    * This TriviaServer can handle multiple clientSockets simultaneously
    * This is accomplished by:
    * - listening for incoming clientSocket request in endless loop
    * - spawning a new TriviaServer for each incoming request
    * Client connects to server with:
    * telnet <ip_address> <port>
    *     <ip_address> = IP address of server
    *  <port> = port of server
    * In this case the port is 4413 , but server can listen on any port
    * If server runs on the same PC as client use IP_addess = localhost
    * The server reads file
    * Note: a production server needs to handle start, stop and status commands
    public class TriviaServerMulti implements Runnable {
        // Class variables
        private static final int WAIT_FOR_CLIENT = 0;
        private static final int WAIT_FOR_ANSWER = 1;
        private static final int WAIT_FOR_CONFIRM = 2;
        private static String[] questions;
        private static String[] answers;
        private static int numQuestions;
        // Instance variables
        private int num = 0;
        private int state = WAIT_FOR_CLIENT;
        private Random rand = new Random();
        private Socket clientSocket = null;
        public TriviaServerMulti(Socket clientSocket) {
            this.clientSocket = clientSocket;
        public void run() {
            // Ask trivia questions until client replies "N"
            while (true) {
                // Process questions and answers
                try {
                    InputStreamReader isr = new InputStreamReader(clientSocket.getInputStream());
                    BufferedReader is = new BufferedReader(isr);
    //                PrintWriter os = new PrintWriter(new
    //                   BufferedOutputStream(clientSocket.getOutputStream()), false);
                    PrintWriter os = new PrintWriter(clientSocket.getOutputStream());
                    String outLine;
                    // Output server request
                    outLine = processInput(null);
                    // Process and output user input
                    while (true) {
                        String inLine = is.readLine();
                        if (inLine.length() > 0)
                            outLine = processInput(inLine);
                            outLine = processInput("");
                        if (outLine.equals("Bye."))
                    // Clean up
                } catch (Exception e) {
                    System.err.println("Error: " + e);
        private String processInput(String inStr) {
            String outStr = null;
            switch (state) {
                case WAIT_FOR_CLIENT:
                    // Ask a question
                    outStr = questions[num];
                    state = WAIT_FOR_ANSWER;
                case WAIT_FOR_ANSWER:
                    // Check the answer
                    if (inStr.equalsIgnoreCase(answers[num]))
                        outStr="\015\012That's correct! Want another (y/n)?";
                        outStr="\015\012Wrong, the correct answer is "
                            + answers[num] +". Want another (y/n)?";
                    state = WAIT_FOR_CONFIRM;
                case WAIT_FOR_CONFIRM:
                    // See if they want another question
                    if (!inStr.equalsIgnoreCase("N")) {
                        num = Math.abs(rand.nextInt()) % questions.length;
                        outStr = questions[num];
                        state = WAIT_FOR_ANSWER;
                    } else {
                        outStr = "Bye.";
                        state = WAIT_FOR_CLIENT;
            return outStr;
        private static boolean loadData() {
            try {
                //File inFile = new File("qna.txt");
                File inFile = new File("data/qna.txt");
                FileInputStream inStream = new FileInputStream(inFile);
                byte[] data = new byte[(int)inFile.length()];
                // Read questions and answers into a byte array
                if ( <= 0) {
                    System.err.println("Error: couldn't read q&a.");
                    return false;
                // See how many question/answer pairs there are
                for (int i = 0; i < data.length; i++)
                    if (data[i] == (byte)'#')
                numQuestions /= 2;
                questions = new String[numQuestions];
                answers = new String[numQuestions];
                // Parse questions and answers into String arrays
                int start = 0, index = 0;
                   String LineDelimiter = System.getProperty("line.separator");
                   int len = 1 + LineDelimiter.length(); // # + line delimiter
                boolean isQuestion = true;
                for (int i = 0; i < data.length; i++)
                    if (data[i] == (byte)'#') {
                        if (isQuestion) {
                            questions[index] = new String(data, start, i - start);
                            isQuestion = false;
                        } else {
                            answers[index] = new String(data, start, i - start);
                            isQuestion = true;
                    start = i + len;
            } catch (FileNotFoundException e) {
                System.err.println("Exception: couldn't find the Q&A file.");
                return false;
            } catch (IOException e) {
                System.err.println("Exception: couldn't read the Q&A file.");
                return false;
            return true;
        public static void main(String[] arguments) {
            // Initialize the question and answer data
            if (!loadData()) {
                System.err.println("Error: couldn't initialize Q&A data.");
            ServerSocket serverSocket = null;
            try {
                serverSocket = new ServerSocket(4413);
                System.out.println("TriviaServer up and running ...");
            } catch (IOException e) {
                System.err.println("Error: couldn't create ServerSocket.");
            Socket clientSocket = null;
            // Endless loop: waiting for incoming client request
            while (true) {
                // Wait for a clientSocket
                try {
                    clientSocket = serverSocket.accept();   // ServerSocket returns a client socket when client connects
                } catch (IOException e) {
                    System.err.println("Error: couldn't connect to clientSocket.");
                // Create a thread for each incoming request
                TriviaServerMulti server = new TriviaServerMulti(clientSocket);
                Thread thread = new Thread(server);
                thread.start(); // Starts new thread. Thread invokes run() method of server.
    }This is the text file:
    Which one of the Smothers Brothers did Bill Cosby once punch out?
    (a) Dick
    (b) Tommy
    (c) both#
    What's the nickname of Dallas Cowboys fullback Daryl Johnston?
    (a) caribou
    (b) moose
    (c) elk#
    What is triskaidekaphobia?
    (a) fear of tricycles
    (b) fear of the number 13
    (c) fear of kaleidoscopes#
    What southern state is most likely to have an earthquake?
    (a) Florida
    (b) Arkansas
    (c) South Carolina#
    Which person at Sun Microsystems came up with the name Java in early 1995?
    (a) James Gosling
    (b) Kim Polese
    (c) Alan Baratz#
    Which figure skater is the sister of Growing Pains star Joanna Kerns?
    (a) Dorothy Hamill
    (b) Katarina Witt
    (c) Donna De Varona#
    When this Old Man plays four, what does he play knick-knack on?
    (a) His shoe
    (b) His door
    (c) His knee#
    What National Hockey League team once played as the Winnipeg Jets?
    (a) The Phoenix Coyotes
    (b) The Florida Panthers
    (c) The Colorado Avalanche#
    David Letterman uses the stage name "Earl Hofert" when he appears in movies. Who is Earl?
    (a) A crew member on his show
    (b) His grandfather
    (c) A character on Green Acres#
    Who created Superman?
    (a) Bob Kane
    (b) Jerome Siegel and Joe Shuster
    (c) Stan Lee and Jack Kirby#

  • Problem starting server with nodemanager

    I have a cluster running on JRockit on Windows 2003 sever and everything works fine when I start nodes from command line, but when I try to start cluster nodes from admin console through node managers in the log file I get:
    <Jul 21, 2006 10:50:57 AM> <Info> <NodeManager> <Starting WebLogic server with command line: C:\bea\JROCKI~1\jre\bin\java -Dweblogic.Name=Alfa1\bea\WEBLOG~1\server\lib\weblogic.policy -Djava.library.path=C:\bea\WEBLOG~1\server\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\bea\WEBLOG~1\server\native\win\32;C:\bea\WEBLOG~1\server\bin;C:\bea\JROCKI~1\jre\bin;C:\bea\JROCKI~1\bin;C:\bea\WEBLOG~1\server\native\win\32\oci920_8;c:\program files\imagemagick-6.2.8-q16;C:\Program Files\Support Tools\;C:\Program Files\Windows Resource Kits\Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\ -Djava.class.path=.;C:\bea\patch_weblogic910\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\bea\JROCKI~1\lib\tools.jar;C:\bea\WEBLOG~1\server\lib\weblogic_sp.jar;C:\bea\WEBLOG~1\server\lib\weblogic.jar;C:\bea\WEBLOG~1\server\lib\webservices.jar -Dweblogic.system.BootIdentityFile=C:\bea\user_projects\domains\alfa_domain2\servers\Alfa1\data\nodemanager\ -Dweblogic.nodemanager.ServiceEnabled=true -Dweblogic.ReverseDNSAllowed=false weblogic.Server >
    <Jul 21, 2006 10:50:57 AM> <Info> <NodeManager> <Working directory is "C:\bea\user_projects\domains\alfa_domain2">
    <Jul 21, 2006 10:50:57 AM> <Info> <NodeManager> <Server output log file is "C:\bea\user_projects\domains\alfa_domain2\servers\Alfa1\logs\Alfa1.out">
    Usage: java [-options] class [args...]
    (to execute a class)
    or java [-options] -jar jarfile [args...]
    (to execute a jar file)
    where options include:
    -jrockit     to select the "jrockit" VM
    -client     to select the "client" VM
    -server     to select the "server" VM [synonym for the "jrockit" VM]
    The default VM is jrockit.
    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    A ; separated list of directories, JAR archives,
    and ZIP archives to search for class files.
    set a system property
    enable verbose output
    -version print product version and exit
    require the specified version to run
    -showversion print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
    include/exclude user private JREs in the version search
    -? -help print this help message
    -X print help on non-standard options
    enable assertions
    disable assertions
    -esa | -enablesystemassertions
    enable system assertions
    -dsa | -disablesystemassertions
    disable system assertions
    load native agent library <libname>, e.g. -agentlib:hprof
    see also, -agentlib:jdwp=help and -agentlib:hprof=help
    load native agent library by full pathname
    load Java programming language agent, see java.lang.instrument
    <Jul 21, 2006 10:50:59 AM> <Info> <NodeManager> <Server failed during startup so will not be restarted>
    It seems that node manager appends system PATH to the java.library.path of the server it is trying to start. The problem is spaces in the system PATH:
    -Djava.library.path=C:\bea\WEBLOG~1\server\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\bea\WEBLOG~1\server\native\win\32;C:\bea\WEBLOG~1\server\bin;C:\bea\JROCKI~1\jre\bin;C:\bea\JROCKI~1\bin;C:\bea\WEBLOG~1\server\native\win\32\oci920_8;c:\program files\imagemagick-6.2.8-q16;C:\Program Files\Support Tools\;C:\Program Files\Windows Resource Kits\Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\
    java expects another option after space.
    How do I make nodemanager not to append system path to server's java.library.path?
    Is there a way to make node manager start server nodes with java.library.path value in quotation marks?
    P.S. I'm running node manager as windows service. I saw a post that solves this problem by starting node manager from command line but this solution is not sufficient.

    Gediminas Aleknavicius skrev:
    How do I make nodemanager not to append system path to server's java.library.path?Hi!
    This news group is about JRockit. People here tend not to know that
    much about non-JRockit products (like nodemanager). Try some WLx forum,
    they should be able to answer your question!
    Regards //Johan

  • VPN Site-to-Site or VPN Client Server with Cisco IP Phone 8941 and 8945

    Hi everyone,
    I decide to deploy a CUCM (BE6K platform), SX20, and IP Phone 8941/8945 on Head Office and Cisco SX10 and IP Phone 8941/8945 for branch offices (actually 9 branch offices).
    The connection will use internet connection for HO and each branch offices.
    And the IT guy want to use kind a VPN client server or VPN site-to-site for the connection through internet,
    what kind of VPN client server or VPN site-to-site that recommended for this deployment?
    and what type of Cisco router that support that kind of VPN (the cheapest one will be great)?
    So the SX10 and IP Phone 8941/8945 in branch offices can work properly through internet connection?
    please advise

    Hi Leo,
    technically, the ipsec users will not use up any premium license seats, so if you have 10 ipsec users connecting first, the premium seats are still free and so you can then still have 10 phones/anyconnect users connect.
    However, the 250 you mention is the global platform limit, so it refers to the sum of premium and non-premium connections. Or in other words, you can have 240 ipsec users and 10 phones,  but not 250 ipsec users and 10 phones.
    If 250 ipsec users and 10 phones would try to connect, it would be first-in, first-served, e.g. you could have 248 ipsec users and 2 phones connected.
    Note: since you have Essentials disabled I'm assuming you are referring to the legacy "Cisco vpnclient" (IKEv1 client) which does not require any license on the ASA. But for the benefit of others reading this thread: if  you do have Anyconnect clients (using SSL or IPsec/IKEv2) for which you currently have an Essentials license, then note that the Essentials and Premium license cannot co-exist. So for e.g. 240 Anyconnect users and no phones, you can use Essentials. For 240 Anyconnect users and 10 phones, you need a 250-seat Premium license (and a vpn phone license).

  • Client-server with  JMX

    I looking for google many time but I dont find an example of solution for my problem. I try to build a server who can exposed a MBean for some clients. For this part it's correct, but when I try to serialize the subclass of my Mbean and I try client-side to chatch them that doesnt work.Do you know how to make that ?
    here un example... but it's my structure is correct to support serializable ? ... and how to set server-side to exposed the Child Class to client ?.. i know for the mbean its correct.. but the subclass..
    public class helloMBean extends Remote{
    public List<Child> getListChild();
    public class hello implement HelloMBean{
    List<Child> lstChild;
    String NameParent;
    lstChild = new ArrayList<Child>();
    public List<Child> getListChild(){
    return lstChild;
    public String getParent()
    return NameParent;
    public void setParent(String name)
    NameParent = name;
    public class Child implements Serializable{
    String Name;
    public Child()
    Edited by: user10365284 on 8 nov. 2012 17:29

    I checked class AuthenticatedUser which does implements through interface UserInfo.
    // Compiled from (version 1.4 : 48.0, super bit)
    public class implements {
    // Field descriptor #50 J
    private static final long serialVersionUID = 6699361079932480379L;
    // Field descriptor #55 Ljava/lang/String;
    public static final java.lang.String REALM_NAME = "wl_realm";
    // Field descriptor #50 J
    private long timeStamp;
    // Field descriptor #55 Ljava/lang/String;
    private java.lang.String name;
    // Field descriptor #59 [B
    private byte[] signature;
    // Field descriptor #61 B
    private byte qos;
    // Field descriptor #63 Ljava/net/InetAddress;
    private inetAddress;
    // Field descriptor #63 Ljava/net/InetAddress;
    private localAddress;
    // Field descriptor #66 I
    private int localPort;
    // Field descriptor #68 Ljava/lang/Object;
    private transient java.lang.Object sslCertificate;
    // Field descriptor #70 Ljava/lang/Class;
    static synthetic java.lang.Class class$weblogic$security$acl$internal$AuthenticatedSubject;
    // Field descriptor #70 Ljava/lang/Class;
    static synthetic java.lang.Class class$weblogic$security$acl$internal$AuthenticatedUser;

  • Problem monitoring server with Azure

    I'm using Application Insights to monitor one application on Windows Azure, I've followed all the instructions and installed and configured Monitoring Agend on the machine, everything seems fine, but no data was generated about the server! I verifyed the
    connections on the URLs, and can connect by telnet normally, I've checked the Event Viewer but nothing! Anyone can help me please?
    Wilson Teixeira ALM Consultant

    Hi Anastasia,
    First of all, very thanks for your help, I verified the web.config and the keys are the same on Azure Portal, I founded the module below on the web.config:
        <modules runAllManagedModulesForAllRequests="true">
          <remove name="ApplicationInsightsWebTracking"/>
          <add name="ApplicationInsightsWebTracking"
            type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.WebRequestTrackingModule, Microsoft.ApplicationInsights.Extensibility.Web"
        <validation validateIntegratedModeConfiguration="false"/>
    I've comment the lines below in web.config because was breaking my application, but if I uncomment no result too and application breaks:
            <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
            <bindingRedirect oldVersion="" newVersion=""/>
            <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
            <bindingRedirect oldVersion="" newVersion=""/>
            <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
            <bindingRedirect oldVersion="" newVersion=""/>
    In the Azure portal I can see some diagnostics as Page Viewes and Exceptions.
    I can use Fiddler, I just need some time to learn about and use in homologation environment first.
    I installed the same web application on my machine and works perfectly, with the same web.config with the keys commented, I runned fiddler on both machines, in my workstation everthing is fine, but in server I can't capture events related to azure, maybe...
    the requests its not working. 
    Wilson Teixeira ALM Consultant

  • HT1222 Is anyone having problems accessing server with iPhone 4S once updated to iOS7?

    I can't reach the server now that I've updated my iPhone 4S to iOS 7. Interestingly, I am using my iPad 2, which was updated at the same time, to post this! Anyone else having server issues with updates...and, in particular, updates of iPhone 4Ss and iOS7? Thank you!

    Yes. I had an iPhone 3G and when upgraded to 6.1 the bluetooth connectivity failed progressively and eventually the phone just wouldn't connect. I broke and reestablished the pairing am few times and each time it would work for a while then disconnect to the extent I thought the bluetooth hardware in the car was failing. I then got an iPhone 5 and the same issue remained. In the last few days I've paired an old Blackberry with the car kit to rule out the BMW hardware. Blackberry is fine so it has to be iOS incompatibility.

  • Sending object between client server with some class without serializable

    Hi friend,
    I need to send the object from server to client via ObjectInputStream and ObjectOutputStream, however, in these objects, some are implements by others, no source code provided, which haven't implement serizlizable, so does anyone can tell me what I can do?
    Thanks your concern.

    Anyone can help? It is urgent!

  • Activatable server with GUI?

    I wonder if an activatable server may have a GUI.
    In what an environment is the server started? Can it
    contact a display?
    Thank you,

    let me make a guess:
    the execution environment is inherited from either
    rmid or rmiregistry.
    Am I right?
    Have fun,

  • Client-Server with LabVIEW

    I have the following Situation , I want to Setup the Labview College License at a Server and make some Clients (the Students) fully accessing the labview on this server Simultaneously, How can i do this? 

    Hello Ahmed,
    There are two ways to increase the number of licenses available in VLM.
    1.) Obtain a new license file from National Instruments.  In addition to the information specified in the linked KB, also include the changes you want to make to you license (add X number of seats).  Then you install this new license file and you will be able to check out more licenses.
    2) Enable Overdraft in Volume License Manager. Go to Options»Preferences»Policies, and enable the overdraft policy for VLM.  This will allow you to check out more licenses than you have, but you will have to pay for all of the extra usage when you send in your activity log at the end of the yearly contract period.
    Also in relation to the previous question you asked about the installation of LabVIEW.  I would recommend looking at this article on Volume License Installers, which gives you a nice way to install software from a central location (network) and ensure that the clients who install it will automatically begin checking out their licenses from the VLM server.
    John B.
    Applications Engineer
    National Instruments

  • Why timesten is slow in client/server mode

    i am testing Timesten client/server mode and find that
    it is to slow.
    when using dircet mode, timesten can precoss about 40000 query pre second
    but when change to client/ server mode
    it can only process 1500 query pre second.
    here is my config and test sql.
    A1 number NOT NULL PRIMARY KEY ,
    A2 number,
    A3 number
    network card is 1000m,
    query code:
    PreparedStatement pSel = dbConn.prepareStatement("select a1,a2 from TEST999 where a1=?");
    rs = null;
    int a1=0;
    int a2=0;
    for(int i=0;i<80000 ;i++)
         pSel.setInt(1,i );
    rs=pSel.executeQuery( );
    if ( {
         a1 = rs.getInt(1);
         a2 = rs.getInt(2);
         if( i%8000==0) {
         System.out.println("select "+ i +" res="+a1 +" time " + getTime_v2());
    direct mode time : 80000 query is 2 second
    client/server mode in the same machine : 80000 query is 12 second
    client/server mode in the different machine : 80000 query is 54 second
    any one have idea about this?
    is it the jdbc driver 's promble?

    it is to be expected that there will be a big difference in performance between direct mode and client/server due to much greater overhead in client/server, especially if the client is on a different machine. However, the differences you are seeing here are larger than I would normally expect.
    You say (I think) that the network is 1 GB, correct? What is the hardware spec of the test machine(s)? Have you tuned the O/S network stack for optimal performance?
    Typically, for local client/server using the fastest IPC mode (shmipc) I expect performance of around 20-30% of direct mode and for remote client/server with a GB LAN I would expect performance of around 10-20% of direct mode.

  • Client Server Socket With GUI

    As the name of the forum suggests I am very new to this whole thing.
    I am trying to write a client/server socket program that can encrypt and decrypt and has a GUI, can't use JCE or SSL or any built in encryption tools.
    I have the code for everything cept the encryption part.
    Any help, greatly appreciated,

    tnks a million but how do i incorporate that into the following client and server code:
    here's the client code:
    import java.awt.Color;
    import java.awt.BorderLayout;
    import java.awt.event.*;
    import javax.swing.*;
    class SocketClient extends JFrame
              implements ActionListener {
    JLabel text, clicked;
    JButton button;
    JPanel panel;
    JTextField textField;
    Socket socket = null;
    PrintWriter out = null;
    BufferedReader in = null;
    SocketClient(){ //Begin Constructor
    text = new JLabel("Text to send over socket:");
    textField = new JTextField(20);
    button = new JButton("Click Me");
    panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add("North", text);
    panel.add("Center", textField);
    panel.add("South", button);
    } //End Constructor
    public void actionPerformed(ActionEvent event){
    Object source = event.getSource();
    if(source == button){
    //Send data over socket
    String text = textField.getText();
         textField.setText(new String(""));
    //Receive text from server
         String line = in.readLine();
    System.out.println("Text received :" + line);
    } catch (IOException e){
         System.out.println("Read failed");
    public void listenSocket(){
    //Create socket connection
    socket = new Socket("HUGHESAN", 4444);
    out = new PrintWriter(socket.getOutputStream(), true);
    in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    } catch (UnknownHostException e) {
    System.out.println("Unknown host: HUGHESAN.eng");
    } catch (IOException e) {
    System.out.println("No I/O");
    public static void main(String[] args){
    SocketClient frame = new SocketClient();
         frame.setTitle("Client Program");
    WindowListener l = new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    SERVER Code
    import java.awt.Color;
    import java.awt.BorderLayout;
    import java.awt.event.*;
    import javax.swing.*;
    class SocketServer extends JFrame
              implements ActionListener {
    JButton button;
    JLabel label = new JLabel("Text received over socket:");
    JPanel panel;
    JTextArea textArea = new JTextArea();
    ServerSocket server = null;
    Socket client = null;
    BufferedReader in = null;
    PrintWriter out = null;
    String line;
    SocketServer(){ //Begin Constructor
    button = new JButton("Click Me");
    panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add("North", label);
    panel.add("Center", textArea);
    panel.add("South", button);
    } //End Constructor
    public void actionPerformed(ActionEvent event) {
    Object source = event.getSource();
    if(source == button){
    public void listenSocket(){
    server = new ServerSocket(4444);
    } catch (IOException e) {
    System.out.println("Could not listen on port 4444");
    client = server.accept();
    } catch (IOException e) {
    System.out.println("Accept failed: 4444");
    in = new BufferedReader(new InputStreamReader(client.getInputStream()));
    out = new PrintWriter(client.getOutputStream(), true);
    } catch (IOException e) {
    System.out.println("Accept failed: 4444");
    line = in.readLine();
    //Send data back to client
    } catch (IOException e) {
    System.out.println("Read failed");
    protected void finalize(){
    //Clean up
    } catch (IOException e) {
    System.out.println("Could not close.");
    public static void main(String[] args){
    SocketServer frame = new SocketServer();
         frame.setTitle("Server Program");
    WindowListener l = new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    Again help on this is very welcomed

  • 10.8.2 Server with DHCP.Windows client problems...

    I have just set up 10.8.2 Server with DHCP. I works almost perfect, but windows clients don`t get an ip-address! I can see the request in the log, but win-clients don`t receive the address! Anyone - help me.....
    I have a screenshot from the log attached, the client "L084" is en Win7 client....

    Current OS X doesn't provide Windows Workgroups and related authentication.   That's entirely different than having OS X Server set up to provide DNS services and DHCP.   Providing workgroups and particularly Active Directory authentication usually involve adding Samba or similar software onto OS X or OS X Server.
    As for the "home" domain, I'd expect to specify the DNS domain that was configured within OS X Server.   Loading random stuff in there might or might not work, as some clients might try or test or use that.  If you're not using the "short" host name specifications, you won't hit that path.   That specification is the default applied when you enter just the host name and not the domain name in an OS X or other DNS query.)  But if something does try that, it'll append "home" and will probably head into the weeds.  (If "home" is the made-up domain that you're using for local DNS, then that is a domain that is quite likely to become a real top-level domain.)

  • Client == server - problems with callbacks

    Hi everyone!
    I'm having trouble establishing bidirectional communication between a client and a server (code samples are below).
    Both classes (client & server) extend UnicastRemoteObject and implement Interfaces that are extending Remote. Now the client looks up the server and tries to register itself at the server by calling a method like this:
    as long as I execute both programs in the same LAN this method-call works fine, but when client and server connect through internet I'm getting the following exception:
    ---------------------- Exception ------------------------>
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
         java.rmi.ConnectException: Connection refused to host:; nested exception is: Connection timed out
         at sun.rmi.server.UnicastServerRef.dispatch(
    <---------------------- Exception ------------------------
    maybe helpful:
    - is the client's LAN-IP
    - I am directly connected to the internet via ADSL-modem (no router)
    I searched the forums for several hours now, I read through the following tutorial,
    but still I didn't find a solution.
    I already spent a lot of time developing this and I start to get desperate, so I hope someone of you out there can help me!
    ==================== Codesamples =======================>
    public class ServerImpl extends UnicastRemoteObject implements Server {
    Client client;
    public ServerImpl() {
    /* specified in Remote-Interface: Server*/
    public void setClient(Client client) {
    this.client = client;
    public class ClientImpl extends UnicastRemoteObject implements Client {
    public ClientImpl() {
    Server s = Naming.lookup("rmi://***.***.***.***:1096/test");
    s.setClient(this); // HERE is the trouble.
    <==================== Codesamples =======================

    Don't feel lost, crumb. Http tunnelling is not as complex as it seems. I just started using RMI at my new job here and in a couple of weeks I've already picked up on alot of what I needed to know. (I just posted a question myself on the same topic.) Basically what you have to do is set up a web server for RMI to talk to at the server side. It will work if the webserver is listening on port 80 with the rmiservlet.ServletHandler registered to respond to any path request of cgi-bin/java-rmi.cgi. In other words "cgi-bin/java-rmi.cgi" should be the servlet-mapping of the ServletHandler. The servlet merly acts as a proxy on behalf of the RMI client and fowards the request to the desired port on the server. If you know how to set up a servlet as the default web app then it is really a breeze. On the client side you only need to set the http.proxyHost and http.proxyPort system properties to the appropriate values for your proxy server. (I mistyped these property names in my prior post use what I have here as I just read it out of the RMI book.) Do a search on HTTP tunnelling and you should turn up dozens of hits. I have the source to the servlet if you need it. I've already modified it for my own purposes though it should still work for you. If you forego http tunnelling then you'll have to do a complete app rewrite to use another protocol because RMI just doesn't work through firewalls without it. Alternatively you can get down and dirty with some low level sockets coding (this is what I'm thinking I'll end up doing eventually) to get it working without standard RMI/HTTP but that's way more complex. Unfortunately it looks like your callback code will need to be rewritten unless you either go commercial or do the socket stuff. (There does seem to be a shareware product called rmi doves that would help you here.) I'll be happy to assits you in any way as you need help.

  • Problems running Application with Web Service Client

    Im having some problems maybe related to some classpath details?
    I am running a Web Service another computer which works fine. I have also made an application using Sun ONE Studio 1 consisting of a Web Service Client etc. and GUI which uses the Client to get data from the Web Service. This works fine as long as I use Sun ONE Studio to execute the application, but now I have packaged the application to a .jar file and have encountered problems:
    When running the application from the .jar file I get the exception:
    java.lang.NoClassDefFoundError: com/sun/xml/rpc/client/BasicService
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(
    at Method)
    at java.lang.ClassLoader.loadClass(
    at sun.misc.Launcher$AppClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    at java.lang.ClassLoader.loadClassInternal(
    at util.servicelocator.ServiceLocator.getServant(
    at lagerApp.eHandelLager.jRegisterBrukerListeActionPerformed(
    at lagerApp.eHandelLager.access$400(
    at lagerApp.eHandelLager$5.actionPerformed(
    at javax.swing.AbstractButton.fireActionPerformed(
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(
    at javax.swing.DefaultButtonModel.fireActionPerformed(
    at javax.swing.DefaultButtonModel.setPressed(
    at javax.swing.AbstractButton.doClick(
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(
    at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(
    at java.awt.AWTEventMulticaster.mouseReleased(
    at java.awt.Component.processMouseEvent(
    at java.awt.Component.processEvent(
    at java.awt.Container.processEvent(
    at java.awt.Component.dispatchEventImpl(
    at java.awt.Container.dispatchEventImpl(
    at java.awt.Component.dispatchEvent(
    at java.awt.LightweightDispatcher.retargetMouseEvent(
    at java.awt.LightweightDispatcher.processMouseEvent(
    at java.awt.LightweightDispatcher.dispatchEvent(
    at java.awt.Container.dispatchEventImpl(
    at java.awt.Window.dispatchEventImpl(
    at java.awt.Component.dispatchEvent(
    at java.awt.EventQueue.dispatchEvent(
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(
    at java.awt.EventDispatchThread.pumpEvents(
    at java.awt.EventDispatchThread.pumpEvents(
    I have searched the forum and found simular topics which are resolved by adding some lines to the classpath.
    How do I set the classpath? Do i have to use the classpath parameter from command window? How can I know which classpaths to include (libraries)..
    Any help would be nice.. : )

    Thank you for the reply..
    But im still geting the same error. I have tried to include all the libraries in JWSDP pack but still.. I have managed to narrow down the place where the error occures.. It actually happens when I try to get the WebService Client Servant which is located in the package LSC:
    ---> LSC.LWServiceGenClient.LWS_Impl service = new LSC.LWServiceGenClient.LWS_Impl();
    LSC.LWServiceGenClient.LWSServantInterface lagerServiceServant = LSC.LWServiceGenClient.LWSServantInterface_Stub)service.getLWSServantInterfacePort();
    return lagerServiceServant;
    Could something be wrong with the way I package the Jar? I'm using Sun One Studio and have tried including the 5 packages the application consists of; I have tried including just the files; moving the main class to <root>.. Still same problem..
    Or could there be some different fundemental thingy I have forgotten ??

Maybe you are looking for

  • Error while excise invoice creation thru J1IJ

    Dear All, Scenario: Stock transfer from Excise depo to other plant. Problem : Excise Invoice is not getting Generate in Transation J1IJ. i am getting following error "Excise invoice selection not complete for the item 000010" Also Please tell me the

  • Need driver for Function Key for Win 7 64bit - Satellite A500-1DN

    I Finished installing Windows 7 Ultimate - 64bit I Want Download "Function Key" Drivers or "Function Key" Software I searched a lot but did not find the ... Please send it to me Satellite A500-1DN please help me...

  • XML IDOC to Native IDOC Conversion

    Hi, We have a scenario, where we need to convert XML idoc into native idoc and write to a file. I am doing this based on How To Convert an IDoc-XML structure to a flat file and vice versa in XI 3.0. When I first executed the scenario, I was getting t

  • CS4 video jumps and shakes when exporting to any video format

    Hi, I created a project in CS4 and exported the video into a Mpeg2 format and the video skips/jumps/shakes instead of playing continuously. When I test the project inside the project the video plays fine. What could be causing the problem. Please hel

  • Vwaas network setup

    Hi team, I am going to configure Vwaas on ESXi 5.1 hypervisor. I have one DC and one Branch Office, and I want to perform optimisation between these two branches. So I need to install ESXi 5.1 hypervisor on both side?? Also where should I placed Cent