/************************************************************************** * * * Net TCP/IP connection routines * * * * Programmed by Ondrej Jombik * * Copyright (c) 2000 Condy software inc. * * Copyright (c) 2001-2003 Platon Software Development Group * * All rights reserved. * * * * Updates: 29.1.2000, 9.2.2000, 21.3.2000, 5.10.2001 * * 20.9.2002 - Doxygen documentation * * * **************************************************************************/ /** * Net TCP/IP connection routines * * @file platon/net/connection.h * @author Ondrej Jombik * @version \$Platon: libplaton/platon/net/connection.h,v 1.12 2003/07/16 16:09:16 nepto Exp $ * @date 2000-2003 */ #ifndef _PLATON_NET_CONNECTION_H #define _PLATON_NET_CONNECTION_H #ifdef __cplusplus extern "C" { #endif /** * Connects to remote host * * @param host hostname * @param port port * @return connection handle (socket) or -1 on error */ int net_connection_open(const char *host, int port); void net_connection_close(int *handle); /** * Read data from connection * * @param handle connection handle (socket) * @retval buffer pointer where to store read data * @param size buffer size * @return count of read bytes or negative value on connection lost */ int net_connection_read(int *handle, void *buffer, int size); int net_connection_read_blocked(int *handle, void *buffer, int size); int net_connection_read_full(int *handle, void *buffer, int size); #if 0 /** * Read one line from connection * * @param handle connection handle (socket) * @retval buffer pointer where to store read data * @param size buffer size * @return count of read bytes or negative value on connection lost * * One line is character set terminated with @ref NET_CONNECTION_EOL. */ int net_connection_gets(int *handle, char *buffer, int size); int net_connection_gets_blocked(int *handle, char *buffer, int size); #endif #ifdef __cplusplus } #endif #endif /* #ifndef _PLATON_NET_CONNECTION_H */