Java socket send integer?

Hello all.
I'm trying to write a java server for a game I'm working on. Sending strings work perfect but I'm having some problems with numbers. The Server sends a string with a number. The client then parse the string to a integer(i + (Integer.parseInt(number));). This gives me a exception.

Is there a way to send int, float etc without the use of strings? If not how should the string be parsed?

Thanks in advance

Comments

  • Can you print/display String number before you try to convert it to int to see if it maybe doesn't represent valid number?
    Can you post Exception text?
  • Thanks for the reply.
    I found my mistake this morning. I had an error in my parsing.

    Once again. Thanks for the reply
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories