Date: Tue, 16 Feb 2010 14:13:58 -0600 From: Adam Vande More <amvandemore@gmail.com> To: Nerius Landys <nlandys@gmail.com> Cc: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: netcat (/usr/bin/nc) buffer size too small - alternate utilities? Message-ID: <6201873e1002161213n16d59089t4db9e08b7d7139bb@mail.gmail.com> In-Reply-To: <560f92641002161142m1e85b647u5f0870896be44958@mail.gmail.com> References: <560f92641002161142m1e85b647u5f0870896be44958@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 16, 2010 at 1:42 PM, Nerius Landys <nlandys@gmail.com> wrote: > I'm communicating with a server that uses UDP packets. The server > receives a UDP packet, and responds with a UDP packet by sending one > to the initial sender. The request packets are always very small in > size, but the response UDP packets can be up to 9216 bytes in size. > > I am using netcat like so: > > echo "$REQUEST_BODY" | /usr/bin/nc -w 1 -u "$PLAYERDB_HOST" > "$PLAYERDB_PORT" > > The response always gets truncated to 1024 bytes using netcat. > > I wrote my own silly version of netcat specifically suited to my needs > over UDP, in Java. I then call it like so: > > echo "$REQUEST_BODY" | /usr/local/bin/java SendUDP "$PLAYERDB_HOST" > "$PLAYERDB_PORT" > > (Source code at the end of this message.) > > With my Java program, I'm able to get up to 9216 bytes in my UDP > response packet; the response won't be truncated to 1024 bytes like in > netcat. > > Now I've read the netcat manpage and it says nothing about any buffer > size or ways to increase it. I don't really want to use my Java > program because starting up a JVM for each server query is very > expensive. Any ideas of any other tools like netcat that will enable > me to receive UDP packets up to 9216 bytes in size? > You can try raising OS's UDP buff size: sysctl kern.ipc.maxsockbuf=8388608 or write an equivalent app in python... -- Adam Vande More
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6201873e1002161213n16d59089t4db9e08b7d7139bb>