FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Bugs
   Software Bugs
(Moderator: fry)
   net routines
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: net routines  (Read 294 times)
madmerv
Guest
Email
net routines
« on: Nov 12th, 2003, 9:47pm »

the net buffer is easily spammed when using this part of proce55ing, I've found this code does not work (and should):
 
String[] data;  // Array to hold the incomming data from the net
BFont Univers45;
 
void setup()
{
  size(640, 480);
  noStroke();
  background(0,0,0);  
  Univers45 = loadFont("Univers45.vlw.gz");
  textFont(Univers45,20);
  status("Reading data from black-ice.psc.edu iam daemon." );
  text( "LOADING", 280, 240 );
  textFont(Univers45,14);  
 
  beginNet("mugs.net", 2000);
}
 
public void mousePressed()
{
}
 
public void netEvent()  
{
  if (net != null)  
  {
    data = net;  // Split and parse the data received in net into lines
  }
}
 
public void mouseMoved()  
{
 
}
 
int x;
 
/*void loop()  
{  
  smooth();*/
  if (data != null)  
  {
     println( data );
     text( data.length, 0, 0 );
     for ( x = 0;  x < data.length; x ++ ) {
  if ( x % 16 == 0 )
  {
  stroke(255);
  fill(255);
  text( word(,  5, 10*(x/16)  );
  }
     }
  }    
/*}*/
 
madmerv
Guest
Email
Re: net routines
« Reply #1 on: Nov 14th, 2003, 6:47am »

Socket s;
BufferedReader in;
PrintWriter out;
 
void setup(){
  try{
    s = new Socket("black-ice.psc.edu",25004);
    in=new BufferedReader(
    new InputStreamReader(s.getInputStream())
    );
    out=new PrintWriter(s.getOutputStream());
 }catch(IOException e){println(e);}
 }
 
 void loop(){
   try{
     println(in.readLine());
  }catch(IOException e){println(e);}
  }
   
  void mousePressed(){
    println("test");
//    s.flush();
  }
 
fry


WWW
Re: net routines
« Reply #2 on: Nov 23rd, 2003, 11:48pm »

yup, as mentioned elsewhere.. net just needs a buncha work.
 
Pages: 1 

« Previous topic | Next topic »