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_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   network packet format?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: network packet format?  (Read 317 times)
senior

89237688923768 WWW
network packet format?
« on: Aug 26th, 2003, 6:02pm »

I'm trying to write a client/server app between a C# application and a processing visualization. I can connect the two using standard socket programming, but when I try to send data from the C# app, the p5 app doesn't seem to detect it.
 
I'm sending straight ASCII bytes to the p5 app, like this:
socket.Send(Encoding.ASCII.GetBytes("SOMETHING"));
 
but apparently p5 doesn't like it... could someone tell me how network data is formatted in processing?
 
Cheers,
-robin
« Last Edit: Aug 26th, 2003, 6:20pm by senior »  
senior

89237688923768 WWW
Re: network packet format?
« Reply #1 on: Sep 1st, 2003, 6:23pm »

Ha! I was sending ASCII strings instead of unicode... works lurvely now. Well, it works for 1-byte at-a-time blocks, but I'm sure I'll figure that out.
 
-robin
 
fry


WWW
Re: network packet format?
« Reply #2 on: Sep 1st, 2003, 9:06pm »

hmm... is the p5 network stuff using unicode or your .NET stuff was? if it's p5, that sounds like a problem. UTF8 might be ok, but in general most network protocols are gonna be ascii or straight 8-bit binary.
 
senior

89237688923768 WWW
Re: network packet format?
« Reply #3 on: Sep 2nd, 2003, 4:37pm »

If my .NET sends in ASCII, it doesn't generate a netEvent in P5; if I send in Unicode, it does.
 
UTF-8 doesn't work either.
 
Also: I'm guessing that P5 buffers network data until it receives a delimiter, correct? Could you tell me what that delimiter is, so I don't accidentally send it?
 
I've replicated it for my application by doing this:
 
Code:
String output = "";
String outputBuffer = "";
 
public void netEvent()
{
  if (net != null) {
    if(!net.equals("|")) {
 outputBuffer = outputBuffer + net;
    }
    else {
 output = outputBuffer;
    }
  }
}
 
Pages: 1 

« Previous topic | Next topic »