localsocket.hh
Go to the documentation of this file.
/*
** localsocket.hh
** Login : Julien Lemoine <speedblue@happycoders.org>
** Started on Sun Mar 2 00:53:36 2003 Julien Lemoine
** $Id: localsocket.hh,v 1.3 2004/11/14 19:37:46 speedblue Exp $
**
** Copyright (C) 2003,2004 Julien Lemoine
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "socket.hh"
#ifndef LIBSOCKET_WIN
#ifndef LOCAL_SOCKET_HH_
# define LOCAL_SOCKET_HH_
namespace Network
{
class LocalSocket : public Socket
{
public:
LocalSocket() :
Socket(LOCAL), _filename("")
{}
LocalSocket(PROTO_KIND pkind) :
Socket(LOCAL, pkind), _filename("")
{}
virtual ~LocalSocket()
{
close();
}
public:
void writeto(const std::string& str,
const std::string& filename);
std::string read();
std::string read(int timeout);
std::string read(std::string& filename);
std::string read(std::string& filename, int timeout);
std::string readn(unsigned int size);
std::string readn(int timeout, unsigned int size);
std::string readn(std::string& filename, unsigned int size);
std::string readn(std::string& filename, int timeout, unsigned int size);
void init(const std::string& filename);
void close();
protected:
int _bind(const std::string& filename);
std::string _read_line(int socket);
std::string _read_line(int socket, std::string& filename);
std::string _read_line_bin(int socket, unsigned int size);
std::string _read_line_bin(int socket, std::string& filename,
unsigned int pkg_size);
void _write_str(int socket, const std::string& str,
const std::string& filename) const;
void _write_str_bin(int socket, const std::string& str,
const std::string& filename) const;
protected:
std::string _filename;
};
}
#endif /* !LOCAL_SOCKET_HH_ */
#endif