| version 1.8, 2002/09/29 03:55:02 |
version 1.9, 2002/10/05 09:52:43 |
|
|
| /************************************************************************** |
/************************************************************************** |
| * * |
* * |
| * Net connection non-object routines * |
* Net TCP/IP connection routines * |
| * * |
* * |
| * Programmed by Ondrej Jombik <nepto@pobox.sk> * |
* Programmed by Ondrej Jombik <nepto@pobox.sk> * |
| * Copyright (c) 2000 Condy software inc. * |
* Copyright (c) 2000 Condy software inc. * |
|
|
| **************************************************************************/ |
**************************************************************************/ |
| |
|
| /** |
/** |
| * Net connection non-object routines |
* Net TCP/IP connection routines |
| * |
* |
| * @file platon/net/connection.h |
* @file platon/net/connection.h |
| * @author Ondrej Jombik <nepto@pobox.sk> |
* @author Ondrej Jombik <nepto@pobox.sk> |
| * @version \$Id$ |
* @version \$Platon: connection.h,v 1.8 2002/09/29 03:55:02 nepto Exp $ |
| * @date 2001-2002 |
* @date 2000-2002 |
| */ |
*/ |
| |
|
| #ifndef _PLATON_NET_CONNECTION_H |
#ifndef _PLATON_NET_CONNECTION_H |
|
|
| # define NET_CONNECTION_EOL "\r\n" |
# define NET_CONNECTION_EOL "\r\n" |
| #endif |
#endif |
| |
|
| /** Default telnet port */ |
/** Default port (telnet) */ |
| #ifndef NET_CONNECTION_PORT |
#ifndef NET_CONNECTION_PORT |
| # define NET_CONNECTION_PORT 23 |
# define NET_CONNECTION_PORT 23 |
| #endif |
#endif |
| |
|
| /** Telnet stream mode */ |
/** Stream mode */ |
| #ifndef NET_CONNECTION_FMODE |
#ifndef NET_CONNECTION_FMODE |
| # define NET_CONNECTION_FMODE "rt+" |
# define NET_CONNECTION_FMODE "rt+" |
| #endif |
#endif |
|
|
| * |
* |
| * @param host hostname |
* @param host hostname |
| * @param port port |
* @param port port |
| * @return telnet connection stream (FILE *) |
* @return connection stream (FILE *) |
| * |
* |
| * Note that ouput stream will be buffered. |
* Note that ouput stream will be buffered. |
| */ |
*/ |
|
|
| * |
* |
| * @param host hostname |
* @param host hostname |
| * @param port port |
* @param port port |
| * @return telnet connection handle or -1 on error |
* @return connection handle (socket) or -1 on error |
| */ |
*/ |
| int net_connection_connect(const char*host,int port); |
int net_connection_connect(const char*host,int port); |
| |
|
| /** |
/** |
| * Read data from connection |
* Read data from connection |
| * |
* |
| * @param handle telnet connection handle |
* @param handle connection handle (socket) |
| * @retval buffer pointer where to store read data |
* @retval buffer pointer where to store read data |
| * @param size buffer size |
* @param size buffer size |
| * @return count of read bytes or negative value on connection lost |
* @return count of read bytes or negative value on connection lost |
|
|
| /** |
/** |
| * Read one line from connection |
* Read one line from connection |
| * |
* |
| * @param handle telnet connection handle |
* @param handle connection handle (socket) |
| * @retval buffer pointer where to store read data |
* @retval buffer pointer where to store read data |
| * @param size buffer size |
* @param size buffer size |
| * @return count of read bytes or negative value on connection lost |
* @return count of read bytes or negative value on connection lost |