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"?>
<classpath>
<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"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>DTEK1066-ryhmis</name>
<name>dtek1066-ryhmis</name>
<comment></comment>
<projects>
</projects>
......
......@@ -4,7 +4,7 @@ import java.io.IOException;
public class Main {
public static void main(String[] args) {
System.out.println("yo");
System.out.println("yo");
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);
}
if(summa>suurin){
arvo=i+1;
summa=suurin;
}
}
return arvo;
}
public void run(){
for(int i=0; i<lanka; i++){
int porttinumero = ;
try{
System.out.println("Avaa portin: " + porttinumero);
ServerSocket lankaserveri = new ServerSocket(porttinumero);
lankasocket[i]=lankaserveri.accept();
numerot[i] = new ObjectInputStream(lankasocket[i].getInputStream());
pankki[i] = new ArrayList<Integer>();
lankaserveri.close();
//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