Commit 097d5d60 authored by Benjamin Krämer's avatar Benjamin Krämer

Added Receiver example

parent 02e5f69e
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="jar" name="gs-netstream">
<property name="bindir" value="bin/"/>
<property name="srcdir" value="src/"/>
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.5"/>
<property name="source" value="1.5"/>
<path id="this.classpath">
<pathelement location="${bindir}"/>
<target name="init">
<mkdir dir="${bindir}"/>
<copy todir="bin">
<fileset dir="src">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
<target name="clean">
<delete dir="${bindir}"/>
<delete file="${}.jar"/>
<target depends="clean" name="cleanall"/>
<target depends="build" name="jar">
<jar jarfile="${}.jar" basedir="${bindir}"/>
<target depends="init" name="build">
<echo message="${}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="${bindir}" source="${source}" target="${target}">
<src path="${srcdir}"/>
<classpath refid="this.classpath"/>
import org.graphstream.graph.Graph;
import org.graphstream.graph.implementations.MultiGraph;
* A simple example of use of the NetStream receiver.
public class ReceiverExample {
public static void main(String[] args) throws UnknownHostException, IOException, InterruptedException {
// ----- On the receiver side -----
// - a graph that will display the received events
Graph g = new MultiGraph("G");
// - the receiver that waits for events
NetStreamReceiver net = new NetStreamReceiver(2001);
// - received events end up in the "default" pipe
ThreadProxyPipe pipe = net.getDefaultStream();
// - plug the pipe to the sink of the graph
// -The receiver pro-actively checks for events on the ThreadProxyPipe
while (true) {
\ 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