I do not understand where is problem?

The basic idea is the following, we have a client and server when the client connects to a server it sends the basic information (IP address and port) and on the basis of this information the server connects to the client, this is just a test program that should serve as part of the solution. The task to be solved by the following, I have three entities client, server and workstation. The client sends a job to the server, the server forward the work to a free station and awaits the results of processing, the workstation may employ other workstations and communicate directly with them (not through the server), that is why it is necessary to make this type of communication. This code working on local computer but when I try it on network it does not work.
import java.io.Serializable;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class ClientInfo implements Serializable {
    private String name;
    private String ip;
    private int serverPort;
    public ClientInfo() {
        name = "Unknown Client";
        try {
            ip = InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            ip = "Unknown Host";
    public String getIp() {
        return ip;
import java.io.Serializable;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class ServerInfo implements Serializable {
    private String name;
    private String ip;
    private int serverPort;
    public ServerInfo() {
        name = "Unknown Client";
        try {
            ip = InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            ip = "Unknown Host";
    public String getIp() {
        return ip;
import java.io.IOException;
import java.net.ServerSocket;
public class MultiClient implements Runnable {
        private ServerSocket serverSocket = null;
        private boolean listening = true;
        private Thread t;
        MultiClient () {
            t = new Thread(this);
            t.start();
        public void run() {
            try {
                serverSocket = new ServerSocket(4003);
                while (listening)
                    new MultiClientThread(serverSocket.accept()).start();
                serverSocket.close();
            } catch (IOException e) {
                System.err.println("Could not listen on port: 4003.");
                System.exit(-1);
import java.io.IOException;
import java.net.ServerSocket;
public class MultiServer {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = null;
        boolean listening = true;
        try {
            serverSocket = new ServerSocket(4004);
        } catch (IOException e) {
            System.err.println("Could not listen on port: 4004.");
            System.exit(-1);
        while (listening)
         new MultiServerThread(serverSocket.accept()).start();
        serverSocket.close();
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
public class MultiClientThread extends Thread {
        private Socket socket = null;
    public MultiClientThread(Socket socket) {
     super("MultiClientThread");
     this.socket = socket;
    public void run() {
        try {
            ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream()); out.flush();
            ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
            Object object = in.readObject();
            if (object instanceof ServerInfo) {
                ServerInfo info = (ServerInfo)object;
                System.out.println(info.getIp());
            out.writeObject(new Integer(100));
     } catch (IOException e) {
         e.printStackTrace();
        catch (ClassNotFoundException e) {}
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
public class MultiServerThread extends Thread {
        private Socket socket = null, cSocket = null;
        ObjectOutputStream out = null; ObjectInputStream in = null;
        ObjectOutputStream cOut = null; ObjectInputStream cIn = null;
    public MultiServerThread(Socket socket) {
     super("MultiServerThread");
     this.socket = socket;
    public void run() {
        try {
            out = new ObjectOutputStream(socket.getOutputStream()); out.flush();
            in = new ObjectInputStream(socket.getInputStream());
            try {
                Object object = in.readObject();
                if (object instanceof ClientInfo) {
                    ClientInfo info = (ClientInfo)object;
                    System.out.println(info.getIp());
                    // Connect on client
                    cSocket = new Socket(info.getIp(), 4003);
                    cOut = new ObjectOutputStream(cSocket.getOutputStream()); cOut.flush();
                    cIn = new ObjectInputStream(cSocket.getInputStream());
                    ServerInfo sInfo = new ServerInfo();
                    cOut.writeObject(sInfo);
                    Object object2 = cIn.readObject();
                    if (object2 instanceof Integer) {
                        Integer broj = (Integer)object2;
                        System.out.println(broj);
            catch (ClassNotFoundException e) {}
     } catch (IOException e) {
         e.printStackTrace();
        try {
            out.close();
            in.close();
            socket.close();
            cOut.close();
            cIn.close();
            cSocket.close();
        } catch (IOException e) {}
import java.io.*;
import java.net.*;
public class Client {
    public static void main(String[] args) throws IOException {
        Socket socket = null;
        ObjectOutputStream out = null; ObjectInputStream in = null;
        try {
            MultiClient multiclient = new MultiClient();
            // Here goes server IP at the moment there is local IP
            socket = new Socket("192.168.1.3", 4004);
            out = new ObjectOutputStream(socket.getOutputStream()); out.flush();
            in = new ObjectInputStream(socket.getInputStream());
            ClientInfo info = new ClientInfo();
            out.writeObject(info);
        } catch (UnknownHostException e) {
            System.err.println("Don't know about host.");
            System.exit(1);
        } catch (IOException e) {
            System.err.println("Couldn't get I/O for the connection.");
            System.exit(1);
        out.close();
        in.close();
        socket.close();
}

when I try it on network it does not work. The information content of that statement is approximately one bit.
Doesn't work how? What happens instead? What exception? What message? What stack trace? What unexpected behaviour?

Similar Messages

  • Mail box behaviour is not okay using gmail. All mails in INBOX gets replicated in Trash. This is a recent phenomenon. Not clear where the problem lies - in Gmail or in new OS in MAC.

    I use MAC Mail box for my gmail account. In the last one month or so, my gmail behaviour is erratic.  When I tyrpe mails and send, a spate of intermediate version gets stored as draft in TRASH forcing these to be manually deleted.
    Another new issue: All INBOX Mails appear now in TRASH also.  If I delete, Trash contents, I lost all mail in INBOX also. I re-created my INBOX content from Archive Mail box. Then all mails appear in TRASH folder alaso.
    I am not sure where the problem lies - Is it an issue of Gamil, or new Maverick OS that I use in my MACPRO.  This was never before say one or two months before.
    The situation is distrubing and please advice whether I should reset any configuration.
    Regards
    Venkat

    I removed all mails sitting in Trash this time by using DELETE command; and then again clicked "REBUILD".  Now the Trash is empty.   I hope the problem is resolved for now. Thanks for the tips given instantly. Venkat

  • HT1529 i do not understand where to find the information

    I am having problems using another computer to download music from Itunes. I can not remember the answers for the security questions.

    Just go to the link below and enter your serial number.
    iPhone 5 Battery Replacement Program - Apple Support

  • SwithcHosts was installed, not understandable, uninstalled, causing problems. FF opens with New tab, not Home Page

    That's SwitchHosts. Uninstalled it, removed from profile, but still FF starts with New tab and not Home Page. Is there a line in about:config that needs changing???

    That didn't work. But, I did remember to do a System Restore, and that seems to have fixed it. SwitchHosts is no friend of mine. Even the MVP program has limits. I wish these programs did not try to take over my computer and they should have good uninstall features.
    Thanks for the reply.
    Walt

  • HT201304 My name is Wyverne Crittenden. I not understanding where is my iTunes funds   going  I put $25.00 I use $9.77 NOW where is the other $15 dollars & sum cents at. Got it this morning NOW no funds.

    My iTunes funds is leavening yesterday out of $25.00 I use $9.77 I seen the reciept for that. Then I went back on it was $15.00 & some cents lift now it's none and this is NOT the first time this happen to me.  I would like to have my iTunes funds back on my iTunes funds.

    Wyverne4 wrote:
    Thank you so much Now I don't feel like I'm crazy. I did for a while. I really thank you so much.
    That's what kids do - they make us feel crazy! You're welcome and I'm glad that you figured it out.

  • Wireless card, internet settings, Safari, not sure where the problem is...

    I have a 13in. black MacBook. Whenever using Safari to connect to the internet, sometimes the computer will be as fast as lightning and other times I type in a web address and nothing, literally nothing happens. And sometimes it will just take ages and ages to go to and load a web page, if it loads at all. I have been to an Apple store, have done all sorts of trouble shooting, and last night erased my hard drive and completely reinstalled the operating system from scratch. Whenever I find something I think will fix the problem (from changing settings all the way to reinstalling operating system), the fix seems to work temporarily and then the old problems resume after a day or two. This problem happens on a variety of networks (public and home) and in a variety of locations (home, school, parents house, Apple store). Please help!!

    Apple Store:
    1. The first time they thought it was a software issue and updated my operating system to SnowLeopard. They did so and it worked brilliantly in the store and then started up with the same old issues when we got home.
    2. The second time (different Apple store), they told me there was nothing wrong with either my hardware or software and that I should try a different browser (I think that is absurd).
    How am I connecting?
    Mostly wireless. The problem lessens considerably when wired. (I asked about whether this could be a problem with the wireless card but Apple said all hardware was "fine" when they ran diagnostics.)
    Type of Router:
    AirPort Express, LinkSys, and several others...all are 2.4gHz
    Hope that helps, thanks for trying to help!

  • Error in flash code....not sure what the problem is

    I created a Flash (CS4, Action Script 3.0) website but when I went to "Control>Test Movie" boxes (that I didn't create) started blinking all over the page and a got this message in the "OUTPUT" tab:
    TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@266305e1 to fl.controls.Button.
    TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@26630311 to fl.controls.Button.
    TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@26630af1 to fl.controls.Button.
    TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@26630ca1 to fl.controls.Button.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at ResoluteMediaFlash4_fla::MainTimeline/__setProp_contact_btn_Scene1_ButtonsandTitle_1()
        at ResoluteMediaFlash4_fla::MainTimeline/frame2()
    I'm very new to flash so I'm not sure where my problem is or how to fix it. 
    Any idea's??
    Thanks...

    Pat's right.. But it also sounds like you probably should go back and do some AS3 basics.   learning how to understand the errors is an important (though frustrating) part of the problem.
    My personal recommendation is Colin Moock's book "Essential ActionScript 3.0"
    Also try my friend and coworker Trevor's genious site: http://www.senocular.com/
    Now, that said, you're using some API that's looking for a button to talk to a movie clip.  Go back and look at what type of symbols your script is trying to talk to.

  • Performance Monitor (System Monitor Scale) I do not understand

    Hi, I am trying to understand System Monitor and the his mesuares buy exists a point that I can not to understand. 
    I see the performance in the task manager and I use 1.57 GB of 2 GB of memory.
    I go to the system monitor and I added the "Avaible MBytes" counter and the chart is on 100% and the value for Last, Average, Minimun and Maximun are 773, 774, 773 and 775 with a scale of 1,000.
    If I change  the scale to 0.1 the percentage of the chart change to 78% aprox. and the value are the same but, If I change to 0.01 this chart change to 8% aprox.
    I do not understand where is the exactly scale that I have to use to see the really percentage of the counter, this question is over this particular counter.
    I was clear? Could you help me?
    thanks.

    The counter you are displaying charts in MB it does not chart in an Percent.
    To truely understand what is going on in memory you will need to read memory chapter in:
     Windows® Internals, Fifth Edition
    http://www.microsoft.com/learning/en/us/Book.aspx?ID=12069&locale=en-us
    The available MB counters includes what is in Free Memory and Standby List.   The standby list will not be flushed unless there is memory presure on the OS. 
    Bruce Adamczak

  • HT1386 I am having problems downloading my music from my PC to my iphone 5s. I have i-tunes on my PC which I also have a different apple ID than what is on my iphone. I tried once to sync and download but do not know where it went. Please help

    I am having problems downloading my music library from my PC to my iphone. I have different apple id's for i-tunes and iphone5s. I did connect iphone to PC via USB and was able to sync and download, but do not know where it downloaded to. I looked under my music on iphone and nothing there.

    You have Sync Music selected under the Music tab or selection for your iPhone sync preferences with iTunes on your PC?

  • Users of imovie experience a lot of problems and crying for help and no one at Apple did not respond I do not understand how a company like Apple puts experts to help users Please note that anonymous experts in Internet offer their help for money

    Users of imovie experience a lot of problems and crying for help and no one at Apple did not respond
    I do not understand how a company like Apple puts experts to help users
    Please note that anonymous experts in Internet offer their help for money

    Users of imovie experience a lot of problems and crying for help and no one at Apple did not respond
    I do not understand how a company like Apple puts experts to help users
    Please note that anonymous experts in Internet offer their help for money

  • Sometimes my iphone 5S produces low sound even on full volume level. Then i do restart it. But i am not sure where exactly the problem is? Need help.

    Sometimes my iphone 5S produces low sound even on full volume level. Then i do restart it. But i am not sure where exactly the problem is? Need help.

    Hi saiyed adil, 
    Thank you for contributing to the Apple Support Communities. 
    It appears that your iPhone 5s sometimes produces low sound, but a restart corrects it. 
    It can take some time to isolate and resolve intermittent issues like this one, and I'd recommend going through the steps in this guide the next time it occurs:
    If you hear no sound or distorted sound from your iPhone, iPad, or iPod touch speaker - Apple Support
    All the best,
    Jeremy 

  • Haveing problems with siri not understanding me

    having trouble with siri not understanding me.  could there be a glitch?

    I  just have a problem that when I ask Siri to schedule an appointment it directs me with a internet search with the words I just said.  So it understnads my words but seems to think I want to search for them rather than schedule the appointment or play the music.  I try Siri every couple of weeks and the response is so bad its worthless.

  • I have a downloaded font file for a school problem on a flash drive and I do not know how to install it into my photoshop application. Need to be walked through this as I am an older user who does not understand any of this stuff.

    I have a downloaded font file for a school problem on a flash drive and I do not know how to install it into my photoshop application. Need to be walked through this as I am an older user who does not understand any of this stuff.

    Fonts are handled by your operating system and installed through the respective System Control panel (Windows) or Fontbook (Mac). On Windows simply type "Fonts" in the search bar in the start menu and when you open the panel/ folder use File --> Add Font. On Mac the procedures are similar, you just need to find the Fontbook app in Applications:Utilities.
    Mylenium

  • Problems installing IWork Pro 9.0.3 Not sure where to place my question but I'm having problems installing iwork 9.0.3

    Not sure where to place my question but I'm having problems installing iwork 9.0. My MacBook Pro doesn't read the disk and ejects after a minute. I just bought the mac and iwork. Any thoughts?

    https://discussions.apple.com/community/iwork

  • Hello i have a problem  i can not use adobe programs. The payment for the month march is not be payed, but i will pay the payment.I can not found where i can do that. Also i see that my membership is stopped.

    Hello i have a problem  i can not use adobe programs.
    The payment for the month march is not be payed, but i will pay the payment.I can not found where i can do that. Also i see that my membership is stopped.

    Try the not-charging topic of:
    iPod touch: Hardware troubleshooting
    It could be that the battery is dead.

Maybe you are looking for

  • Vendor Outstanding Payment with reference to Purchase Order

    Is there any standard report to see outstanding payments for vendors? I wanted to see purchase orders no, miro no, vendor, clear amount, pending amount, clearing document etc. i tried FBL1N but i didnt get po no. there. Please Guide.

  • How many devices can use the same rescue email?

    I support over 40 ipads at  my school. I want teachers to set up a rescue email that comes to me in case they are locked out. How many different apple ids can use the same rescue email address ?

  • GlobalContainer x Global Variable Java Section

    Guys, My requirement: I have a variable that'll be read from message header with DynamicConfiguration and will be used in several UDFs in a message mapping. Are there any problems in using either GlobalContainer object or Global Variable in Message M

  • How do I Reinstall My Creative Suite Master Collection version CS6 onto my New Mac???

    Hello all,    After 2.5 years, my "new" now "old" macbook pro crapped out.  Well before it did, as a graphic designer, I purchased the CS6 Master Suite Collection.  I have my serial number, yet am unable to figure out how to reinstall the programs on

  • Need help with cfif, cfelseif

    I am trying to display a slideshow within an include file depending upon what category selection someone makes within a CF page. I have tried the following using both URL= and template= with no luck. Any help would be appreciated. <cfif TxtProductMen