[aprssig] Periodic Disconnects from APRS-IS

Gregg Wonderly gregg at wonderly.org
Thu Jan 18 12:29:49 EST 2007


Scott Miller wrote:
> Last time I looked at a TCP dump of an APRS-IS connection, it seemed to be
> making rather inefficient use of the bandwidth.  I saw exactly one line per
> packet.  For slow ports (message only, local filters) this is fine - it
> keeps the stream from getting held up in the TCP buffers.  But for a full
> feed, it seems like you'd be better off offering a port that'd send a
> maximal length packet to reduce overhead.  Should reduce the packet count by
> about a factor of 10.
> 
> I don't know about Java's socket support, but I think in C it was a pretty
> simple configuration option.  Again, it's not what you want for everything,
> but it seems like an easy way to save bandwidth.

In Java, you can just use a BufferedWriter or BufferedOutputStream to make sure 
that writes are optimized.  I've been using the jdk1.5 concurrency tools so that 
  I can use a queue to stuff the outbound packets into, and then just dequeue 
and write through a buffered outputstream, flushing when the queue is empty.

Something like the following is a simple example without any attempts to manage 
CR/LF in any special way.

PrintStream out = new PrintStream( new BufferedOutputStream( 
sock.getOutputStream() ) );
LinkedBlockingQueue<String> queue = new LinkedBlockingQueue<String>();
String pktln;
boolean done = false;

while( !done ) {
	pktln = queue.take();
	out.println(pktln);
	if( queue.peek() == null )
		out.flush();
}

Gregg Wonderly
W5GGW




More information about the aprssig mailing list