CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2010
    Posts
    12

    Unhappy Simple problem I think

    Solved
    Last edited by Bunty Ranu; October 8th, 2010 at 10:31 AM.

  2. #2
    Join Date
    Feb 2008
    Posts
    966

    Re: Simple problem I think

    Besides the fact that main is throwing exceptions instead of just placing the code inside of the try/catch block that you already have, it's not bad. Yeah, you have it: that is the basics of socket connections. Create an input stream, an output stream and go. I personally use the ObjectOutputStream and ObjectInputStream when I do socket implementations, but that's just me.

    Have you tried to run it? What do you get?

  3. #3
    Join Date
    Apr 2010
    Posts
    12

    Re: Simple problem I think

    When I run it nothing happens, so I'm confused... not sure what the problem could be. >.<

    I'm suppose to get a String returned from the server, not sure if it is a coding error on my end, or if the Server isn't sending it to me. When I send the new line character, I should be replied with the current time. What do you suggest?

  4. #4
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: Simple problem I think

    Try reading the input stream until the end of stream is reached. When I ran your code the input stream contained a blank line before the data line.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  5. #5
    Join Date
    Apr 2010
    Posts
    12

    Re: Simple problem I think

    Quote Originally Posted by keang View Post
    Try reading the input stream until the end of stream is reached. When I ran your code the input stream contained a blank line before the data line.
    Once again Keang you've helped me. You catch these little things really well. Thank you so much Keang!

  6. #6
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: Simple problem I think

    You catch these little things really well.
    When you've made as many mistakes as I have you get good at correcting them.

    Thank you so much Keang
    My pleasure.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  7. #7
    Join Date
    Jun 2007
    Location
    Aurora CO USA
    Posts
    137

    Re: Simple problem I think

    Quote Originally Posted by keang View Post
    When you've made as many mistakes as I have you get good at correcting them.

    My pleasure.
    Isn't that the truth; I right there with you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured