/* * portfwd.c - simple TCP/IP port forwarder * * Developed by Ondrej Jombik * Copyright (c) 2003 Platon SDG, http://platon.sk/ * Licensed under terms of GNU General Public License. * All rights reserved. * * Changelog: * 20/11/2003 - created * */ /* $Platon: libplaton/utils/portfwd/portfwd.c,v 1.1 2006-08-16 21:04:23 nepto Exp $ */ /* Compilation against libplaton library: gcc -pedantic -L ../../platon/ -I ../../ -o portfwd portfwd.c -lplaton */ #include #include #define BUFSIZE 4096 int main(int argc, char **argv) /* {{{ */ { char buf[BUFSIZE]; netConnection conn; conn.setHost("localhost", 25); if (! conn.connect()) { fprintf(stderr, "connection failed"); return 1; } while (conn.isConnected()) { if (conn.readData(buf, BUFSIZE) > 0) { printf("[returned][%s]\n", buf); conn.writeLine("QUIT"); } } conn.disconnect(); return 0; } /* }}} */ /* Modeline for ViM {{{ * vim: set ts=4: * vim600: fdm=marker fdl=0 fdc=3: * }}} */