SockPrintf

printf for TCP and UDP sockets. Provides a cross-platform tcpprintf and udpprintf that work somewhat like fprintf but accept TCPFILE* or a hostname(!) as a char* as the first argument.

int udpprintf(const char *host, int port, const char *fmt, ... /*args */);
TCPFILE *tcpopen(const char *host, int port);
int tcpprintf(TCPFILE *stream, const char *fmt, ... /*args */);
void tcpclose(TCPFILE *stream);

There are some other utility functions too (e.g. open a server socket, send bytes, va_list versions, error reporting, etc.).

sockprintf/trunk

Documentation

Works just like printf!

Requirements

  • POSIX (Linux, OSX) or Windows (winsock 1.1.)

SVN Checkout & Building & Running

svn co http://code.apted.net/svn/pub/sockprintf/trunk sockprintf
# For now, this is not a library, so just add the files to your project