buffer
import java.net.*; import java.io.*; int WW=1920, HH=1080; int d=5; int mlt=20, mtp=20; int cols=((WW-mlt*2)/d) - 2; int rows=(HH-mtp*2)/d; int ca[][] = new int[rows][cols]; int ca_1[][] = new int[rows][cols]; int nca[][] = new int[rows][cols]; Thread lrt, rrt; Thread lst, rst; celrcvr lr, rr; celsndr ls, rs; String lhost="127.0.0.1"; //"192.168.1.2"; String rhost="127.0.0.1"; //"192.168.1.2"; int lport=9181; int rport=9191; volatile int lhs[]=new int[rows]; volatile int rhs[]=new int[rows]; void setup() { noStroke(); background(0); fullScreen(); frameRate(15); cainit(); for (int i=0; i
void cainit() { for (int j=0; j
enum celwal { LEFT, RIGHT } class celrcvr implements Runnable { ServerSocket ss; volatile String msg; volatile boolean halt; volatile int[] xa; int xai; celrcvr(int port, int arr[]) { halt=false; xa=arr; xai=0; try { ss=new ServerSocket(port); msg="SS:"+port; } catch(IOException ioe) { msg=ioe.getMessage(); ioe.printStackTrace(); } } public void run() { try { msg="ss.accept()"; Socket s=ss.accept(); DataInputStream dis = new DataInputStream(s.getInputStream()); msg="readByte()"; while (!halt) { byte _i=dis.readByte(); xa[xai]=_i; xai=(xai+1)%rows; } msg="halt!"; } catch(EOFException eofe) { msg="EOFException!"; eofe.printStackTrace(); } catch(IOException ioe) { msg="IOException!"; ioe.printStackTrace(); } } } class celsndr { Socket s; String rhost; int rport; volatile String msg; volatile boolean halt; celwal cw; DataOutputStream dos; celsndr(String host, int port, celwal _cw) { halt=false; rhost=host; rport=port; cw=_cw; try { s=new Socket(rhost, rport); msg=rhost+":"+rport; dos = new DataOutputStream(s.getOutputStream()); msg="DOS ready"; } catch(IOException ioe) { msg="IOException!"; ioe.printStackTrace(); } } public void bcastcelwal() { try { if (cw==celwal.LEFT) { for (int i=0; i