Commit 08ec3eed authored by Teemu's avatar Teemu
Browse files

Merge remote-tracking branch 'upstream/master'

parents c3989fcd ac7dc3dd
<?xml version="1.0" encoding="UTF-8"?>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
<classpathentry excluding="fi/utu/dtek1066/" kind="src" path="dtek1066-ryhmis/src"/>
<classpathentry kind="output" path="dtek1066-ryhmis/bin"/>
<?xml version="1.0" encoding="UTF-8"?>
......@@ -4,7 +4,7 @@ import;
public class Main {
public static void main(String[] args) {
SocketHandler socketHandler = null;
StreamHandler streamHandler = null;
try {
package fi.utu.dtek1066;
//class public Summatallennus{
public static class Summainlanka extends Thread {
//private final Semaphore vapaa = new Semaphore(1);
private Socket[] lankasocket= new Socket[lanka];
private ObjectInputStream[] numerot = new ObjectInputStream[lanka];
private static ArrayList<Integer>[] pankki = new ArrayList[lanka];
static public int getSumma(){
int summa = 0;
for(int i=0; i<lanka; i++){
for(int j=0; j<pankki[i].size(); j++){
summa = summa + pankki[i].get(j);
return summa;
static public int getKoko(){
int koko=0;
for(int i=0; i<lanka; i++){
koko = koko + pankki[i].size();
return koko;
static public int getSuurin(){
int arvo=0;
int suurin=0;
int summa=0;
for(int i=0; i<lanka; i++){
for(int j=0; j<pankki[i].size(); j++){
summa = summa + pankki[i].get(j);
return arvo;
public void run(){
for(int i=0; i<lanka; i++){
int porttinumero = ;
System.out.println("Avaa portin: " + porttinumero);
ServerSocket lankaserveri = new ServerSocket(porttinumero);
numerot[i] = new ObjectInputStream(lankasocket[i].getInputStream());
pankki[i] = new ArrayList<Integer>();
//synchronized (portti){}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment