• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Client server help

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a client server program. First you have to laod the server, create a file for the has map to write to then start the client portion. Once the client is running when i type in a name and try to add a name and number it just says invalid number. It not writing from the client server. Any ideas on why it is not doing that would be very helpful.

 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would probably make things easier for both of use if you'd start from scratch. Write a client and a server that just send a string back and forth. Then add a feature, like sending a Person object, and get that to work. It would be far simpler to narrow down what isn't working in that case than plowing through this 1000 lines of code, not to mention you'd have a better grasp as to what's going on in your code.
It would pay to become familiar with the API Documentation. For example, you may have noticed that in the entry for java.io.ObjectInputStream it says:


The ObjectInputStream constructor blocks until it completes reading the serialization stream header. Code which waits for an ObjectInputStream to be constructed before creating the corresponding ObjectOutputStream for that stream will deadlock. . .


In other words, your server thread never starts up because execution is blocked on fromClient = new ObjectInputStream(connection.getInputStream());
One useful debug technique is putting System.out.println(""); statements everywhere and watch the console to make sure you have the values you think you do. You may have noticed that around line 820 you do this:

then a few lines later you do this:

phoneNumber is blank. That's why you are getting that invalid number message.
[ December 02, 2003: Message edited by: Joe Ess ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic