Advertisement

05.07.2008 at 07:10PM PDT, ID: 23384868
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.1

Problem with socket, readobject and instanceof

Asked by ikjop in Java Programming Language, Programming Languages, J2EE

Tags: , ,

I'm building a client/server application, when a client logs onto the server he sends his "clientobject" (Classname Speler) to the server. The server should notice that when he recieves an instance of "Speler" it's a new client on the server. I've written the following code to do this. (see code snipped)..

The error is in  

if(messageObject instanceof Speler) {
                    System.out.println("here230");
                    server.frmMain.addUserOnlineEvent((Speler) messageObject);
                }

After debugging i can see that messageObject is indeed of the type Speler (i added a watch to "messageObject"), but for some reason he can't check it because he says that "Speler is not a known variable in the current context". I don't understand ? Speler is a class in the same package, hé even listed "Speler" in the code completion list. What mistake did i make, please help :)Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
public void run(){
        try {
            
            //wachten op inkomende message
            boolean stop = false;
        
            while(!stop) {
 
                Object messageObject = istream.readObject();                
                
               if(messageObject instanceof Speler) {
                    System.out.println("here230");
                    server.frmMain.addUserOnlineEvent((Speler) messageObject);
                }
        }
            
        } catch(IOException ex){
            ex.printStackTrace();
        }  catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        } finally {
            try {
                if (link != null){
 
                    ostream.writeObject("QUIT!!!");
 
                    server.removeClientHandler(this);
                    server.setClientCount(server.getClientCount()-1);
                    
                    link.close();
                }
            }
            
            catch(IOException e){
                e.printStackTrace();
            }
        }
    }
 
Loading Advertisement...
 
[+][-]05.07.2008 at 08:10PM PDT, ID: 21522051

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 11:10PM PDT, ID: 21522623

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 11:44PM PDT, ID: 21522734

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 01:10AM PDT, ID: 21523066

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 01:15AM PDT, ID: 21523081

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 01:21AM PDT, ID: 21523115

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 01:24AM PDT, ID: 21523126

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 01:30AM PDT, ID: 21523147

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 01:37AM PDT, ID: 21523180

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 01:39AM PDT, ID: 21523188

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 01:42AM PDT, ID: 21523200

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 01:53AM PDT, ID: 21523243

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 02:38AM PDT, ID: 21523369

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Programming Language, Programming Languages, J2EE
Tags: Sun, Java, 1.6.0_06
Sign Up Now!
Solution Provided By: MicheleMarcon
Participating Experts: 4
Solution Grade: A
 
 
[+][-]05.08.2008 at 02:55AM PDT, ID: 21523429

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080924-EE-VQP-39 / EE_QW_2_20070628