Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

Evan Yang

Greenhorn
+ Follow
since Apr 20, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Evan Yang

Paul Clapham wrote:

Evan Yang wrote:Upon receiving the message, A, B and C are supposed to start their individual sub-tasks simultaneously, and finish working on the sub-tasks at the same time (this part can be controlled by a counter on the client side).


This is an extremely strange requirement. Start simultaneously? Finish at the same time? Why are those requirements? Why is it a problem if B starts a quarter of a second later than A and C?

Evan Yang wrote:I am thinking S can broadcast the initial message to A, B, and C via sockets. However, how can we ensure that the clients A, B, and C all start at the same time (e.g. what if the message to A arrives slightly later than the ones to B and C because of some network issue?)


You can't ensure that. There isn't even a way to monitor whether A, B, and C start at the same time, let alone enforce it.



Imagine the server S is the 'judge', and clients A, B and C are 'competitors' who compete to execute the same given task, and there is a time limit (say 30s) for them to do it, and their performance/quality of execution is recorded at the end of the 30s and sent back to S.

Ideally, once the server says 'START', then the 30s countdown on A, B, and C starts simultaneously. Now, I understand that the 'START' message may not arrive at A, B, and C simultaneously, and hence the agents may not all start at the same time. But is there any way we can keep the difference in start times as small as possible? For example, I wouldn't want C to start 20s after A and B have started.

Paul Clapham wrote:

Evan Yang wrote:In addition, the clients will send some messages back to the server at end of each of their sub-tasks. So S should only initiate the next 'round' of communication after it receives all the messages from the clients in the current 'round'. I wonder how we can enforce such behavior.


The server simply waits until it has received all of the messages. I'm not sure what you mean by "how we can enforce such behavior"... the simplest thing would be to have three boolean variables which record when each of the three messages have been received, for example. Was that the sort of question you meant that to be?



Yes, I just need a mechanism that makes sure the server has received all the results for the current round/task before moving on to the next one, as certain information from previous rounds/tasks are used in the future rounds/tasks.

Hi,

I am relatively new to Java network programming, and would appreciate if anyone could point me to the right direction to the problem below:

A server S and three clients named A, B, and C respectively are on a network. A task is initiated by S, and is repeated for a number of times. For each run of the task, S sends a message to A, B, and C. Upon receiving the message, A, B and C are supposed to start their individual sub-tasks simultaneously, and finish working on the sub-tasks at the same time (this part can be controlled by a counter on the client side).

I am thinking S can broadcast the initial message to A, B, and C via sockets. However, how can we ensure that the clients A, B, and C all start at the same time (e.g. what if the message to A arrives slightly later than the ones to B and C because of some network issue?)

In addition, the clients will send some messages back to the server at end of each of their sub-tasks. So S should only initiate the next 'round' of communication after it receives all the messages from the clients in the current 'round'. I wonder how we can enforce such behavior.

Thanks!