• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

MultiThreaded server : first socketclient work the other dosent work

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey.

I got a problem that the first socket that connects to the server works but the second one WORKS BUT than the first dosen't work.

And it keeps on and on..

If you connect even the 8 client it works but than the 7 and earlier clients wont work.

Server:


Thanks in advance.
 
author
Posts: 23937
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Your client service thread is using lots of variables -- out, bufferedReader, output, etc. -- perhaps you can show us more code that include those declarations?

Henry
 
Amit Shef
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is basically all my code on the Server.class

My client is the basic client like

Socket socket = new Socket(IP,PORT);
output..
input..
....
 
Henry Wong
author
Posts: 23937
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Amit Shef wrote:This is basically all my code on the Server.class




The ClientServiceThread class is a nested class. And it is using variables that it did not declare -- which is assumed to be declared in the outer class (as static variables)... so, obviously, you haven't show us all your code.

Anyway, if you happened to do what I just described, then the issue is that your nested class instances are using the same static variables of the outer class, and stepping on each other.

Henry
 
Amit Shef
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You were right

Thank you.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic