Page 2 of 2 FirstFirst 12
Results 21 to 36 of 36
Like Tree1Likes

Thread: Another socket (multiclient) problem....

  1. #21
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,556
    Rep Power
    23

    Default Re: Another socket (multiclient) problem....

    Did you try changing the server as I suggested? What was printed out?
    If you don't understand my response, don't ignore it, ask a question.

  2. #22
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,556
    Rep Power
    23

    Default Re: Another socket (multiclient) problem....

    My download tool timed out on both the URLs you posted, I was not able to get a copy of the client code.
    If you don't understand my response, don't ignore it, ask a question.

  3. #23
    Lionlev is offline Senior Member
    Join Date
    May 2012
    Posts
    172
    Rep Power
    2

    Default Re: Another socket (multiclient) problem....

    Quote Originally Posted by Norm View Post
    Sorry, I don't have adobe flash.

    What did the program read when you changed it to use the read() method to read the bytes one by one and print them as they were read?
    Oh, i read it wrong... Server reads two words "username userpassword" and adds to variables string username = username and string userpassword = userpassword.
    You can see it here:
    Java Code:
    String username = INPUT.next();
                            String userpassword = INPUT.next();
                            System.out.println("User's username: " + username +"\n" + "User's password: " + userpassword);

  4. #24
    Lionlev is offline Senior Member
    Join Date
    May 2012
    Posts
    172
    Rep Power
    2

    Default Re: Another socket (multiclient) problem....

    Quote Originally Posted by Norm View Post
    My download tool timed out on both the URLs you posted, I was not able to get a copy of the client code.
    The forum is quite confusing... I didn't notice the second page...

    The last thing that printned out was "Getting info" I've put that before "if got everything == false"

  5. #25
    Lionlev is offline Senior Member
    Join Date
    May 2012
    Posts
    172
    Rep Power
    2

    Default Re: Another socket (multiclient) problem....

    Quote Originally Posted by Norm View Post
    My download tool timed out on both the URLs you posted, I was not able to get a copy of the client code.
    Do you have skype?

  6. #26
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,556
    Rep Power
    23

    Default Re: Another socket (multiclient) problem....

    What did the program read and print when you changed it to use the InputStream's read() method to read the bytes one by one and print them as they were read?
    If you don't understand my response, don't ignore it, ask a question.

  7. #27
    Lionlev is offline Senior Member
    Join Date
    May 2012
    Posts
    172
    Rep Power
    2

    Default Re: Another socket (multiclient) problem....

    Quote Originally Posted by Norm View Post
    What did the program read and print when you changed it to use the InputStream's read() method to read the bytes one by one and print them as they were read?
    I told you it is reading two words like: "user123 pass123" I made it read like that: string username = input.next(); and string password = input.next(); and then printing username and password out but it doesnt

  8. #28
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,556
    Rep Power
    23

    Default Re: Another socket (multiclient) problem....

    it is reading two words like: "user123 pass123"
    If it is reading those two words, then what is the problem?
    If you don't understand my response, don't ignore it, ask a question.

  9. #29
    Lionlev is offline Senior Member
    Join Date
    May 2012
    Posts
    172
    Rep Power
    2

    Default Re: Another socket (multiclient) problem....

    Quote Originally Posted by Norm View Post
    If it is reading those two words, then what is the problem?
    The problem is that it doesn't read anything until client send same two words again, but also when client sends it second time the program reads it as "user123 pass123 user123"

  10. #30
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,556
    Rep Power
    23

    Default Re: Another socket (multiclient) problem....

    The code you posted worked for me when I used a browser for the client. Have you tried using any other client programs to see if your code works with them? It may be a problem with your client code.
    If you don't understand my response, don't ignore it, ask a question.

  11. #31
    Lionlev is offline Senior Member
    Join Date
    May 2012
    Posts
    172
    Rep Power
    2

    Default Re: Another socket (multiclient) problem....

    Quote Originally Posted by Norm View Post
    The code you posted worked for me when I used a browser for the client. Have you tried using any other client programs to see if your code works with them? It may be a problem with your client code.
    Did server out put it like that?
    User's username: user123
    User's password: pass123
    ?

  12. #32
    Lionlev is offline Senior Member
    Join Date
    May 2012
    Posts
    172
    Rep Power
    2

    Default Re: Another socket (multiclient) problem....

    Quote Originally Posted by Norm View Post
    The code you posted worked for me when I used a browser for the client. Have you tried using any other client programs to see if your code works with them? It may be a problem with your client code.
    Here what I see:
    Another socket (multiclient) problem....-problem.jpg

  13. #33
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,556
    Rep Power
    23

    Default Re: Another socket (multiclient) problem....

    The browser sent a normal HTTP GET to the server. The first two words read were from that:

    User's username: GET
    User's password: /


    You should add more printlns to the code to show when and what is happening.
    Also for debugging, send different username and passwords so you know which set of data is being read: the first or the second.

    Did you notice that the printout for the password had the password and the next userid?

    How did the call to the next() method put those two strings together? What char is between the end of the first password and the beginning of the second userid?
    Last edited by Norm; 06-06-2012 at 04:37 PM.
    If you don't understand my response, don't ignore it, ask a question.

  14. #34
    Lionlev is offline Senior Member
    Join Date
    May 2012
    Posts
    172
    Rep Power
    2

    Default Re: Another socket (multiclient) problem....

    Quote Originally Posted by Norm View Post
    The browser sent a normal HTTP GET to the server. The first two words read were from that:

    User's username: GET
    User's password: /
    Well then that's weird...

  15. #35
    Lionlev is offline Senior Member
    Join Date
    May 2012
    Posts
    172
    Rep Power
    2

    Default Re: Another socket (multiclient) problem....

    Quote Originally Posted by Lionlev View Post
    Well then that's weird...
    OHH!1!! I found the problem, once my client adds a spacebar to the string that it sends, the server reads it correctly, I have no idea why but it's working fine now..
    Maybe the problem is in the "input.next();" somehow...

    But thanks for everything! Sorry for disturbing again.
    Fubarable likes this.

  16. #36
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,556
    Rep Power
    23

    Default Re: Another socket (multiclient) problem....

    Glad you have solved it.
    If you don't understand my response, don't ignore it, ask a question.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. multiclient/server program
    By maxi in forum Networking
    Replies: 12
    Last Post: 09-30-2011, 05:19 PM
  2. how to do multiclient private chat using socets and threads?
    By tanu.kansal in forum Threads and Synchronization
    Replies: 27
    Last Post: 08-25-2011, 05:31 PM
  3. MultiClient with Single Server
    By prince87 in forum Threads and Synchronization
    Replies: 1
    Last Post: 05-01-2011, 01:03 AM
  4. Socket Connection problem
    By xpan in forum Networking
    Replies: 4
    Last Post: 02-14-2010, 04:32 PM
  5. multiclient copy
    By thuyduong89dt in forum Networking
    Replies: 0
    Last Post: 12-04-2009, 01:46 PM

Posting Permissions

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