File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes Multiple sockets cause Threads Hangin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Multiple sockets cause Threads Hangin " Watch "Multiple sockets cause Threads Hangin " New topic

Multiple sockets cause Threads Hangin

chris achalon

Joined: Aug 20, 2003
Posts: 2
Hello, I need help.
First, let me explain what I'm doing:
I'm building a web messenger program for in-house tech support for my workplace.
The concept:
A user on the internet clicks a link, this opens a Client program. The client program connects to the server here in the building. The server in turn, connects to a MessageDaemon program running on an Admin's computer. The MessageDaemon then opens a Client program on the Admin's comp so the user may speak to him. This should be able to happen multiple times. Each time a new person connects, the Admin will open a New Client to speak with them. Note: This is a one to one connection, one admin speaking to one user is all the user sees. But that one admin may be running multiple Client programs on his comp.
The problem:
Everything works until the server tries to accept the data sent from both Client programs. Each client program is comming in over a different socket and port. While they can both connect to the server with no problem, I don't know how to get the server to read their data correctly. My problem is in the following lines:

I have tried multiple variations of these lines using if statements and such, but nothing works! I understand the problem, I just don't know how to fix it!
Here is the full server code:

Can anyone help me please?
chris achalon

Joined: Aug 20, 2003
Posts: 2
Boy that code is small, that initial code is in the middle of the HandleAClient Class at the bottom.
I agree. Here's the link:
subject: Multiple sockets cause Threads Hangin
It's not a secret anymore!