Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 29. jún 2022

Súbor: [Platon] / libplaton / utils / portfwd / portfwd.c (stiahnutie)

Revízia 1.2, Fri Dec 26 18:08:22 2008 UTC (13 years, 6 months ago) by nepto


Zmeny od 1.1: +2 -2 [lines]

Fixed typo: agains -> against

/*
 * portfwd.c - simple TCP/IP port forwarder
 *
 * Developed by Ondrej Jombik <nepto@platon.sk>
 * 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 <stdio.h>
#include <platon/net/Connection.h>

#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:
 * }}} */


Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok