|
-
Jan 13th, 2003, 11:19 AM
#1
Thread Starter
Hyperactive Member
TCP/IP Question
For my university project, We have to create a client / server application in java. Which should be capable of having multiple clients running from same server at any 1 time.
I chose to create a Electorinic POS system (Computerised till).
When you start the till (client) it connects to the transaction server (server), and waits on user to login to till.
If I start up more than 1 till, The first 1 starts up correctly, however the subsequent ones, fail to connect to the server. (Well they connect but dont connect), as in the server fails to authorise it, and it refuses to do anything.
If I then close the first till down, The second till will start up, if I close that, the third one starts up. and so on.
I am assuming this is because I havn't allowed for multiple simultaneous connections (I made the assumption, this would happen automatically - Im too use to VB ).
Having done some research I have concluded this is achieved using threads (Of which I have no idea what they are).
I would appreciate it, if anyone could explain, or even take the time to point me in the right direction, or show me how this is achieved.
Thank you in advance
-
Jan 15th, 2003, 06:38 PM
#2
Threads enable your application to run different parts of code independently and "at the same time". Actually it's not at the same time unless you have multiple CPUs, but the threads are intermixed so it appears to be at the same time.
In Java threading is very easy. Just derive a class from java.lang.Thread, override it's run-method, create an object of this class and call the start-method.
There are several issues concerning synchronization when accessing shared resources, but that is not that important at first.
So what you have to do is listen for connections and when one comes in spawn a thread that handles it.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|