#include <cerrno>
-
-namespace lyx {
-
#if defined (_WIN32)
# include <io.h>
#endif
using std::string;
+namespace lyx {
+
// Address is the unix address for the socket.
// MAX_CLIENTS is the maximum number of clients
// that can connect at the same time.
{
if (fd_ != -1) {
theApp->unregisterSocketCallback(fd_);
- if (close(fd_) != 0)
+ if (::close(fd_) != 0)
lyxerr << "lyx: Server socket " << fd_
<< " IO error on closing: " << strerror(errno);
}
{
string const linen(line + '\n');
int const size = linen.size();
- int const written = write(fd_, linen.c_str(), size);
+ int const written = ::write(fd_, linen.c_str(), size);
if (written < size) { // Always mean end of connection.
if ((written == -1) && (errno == EPIPE)) {
// The program will also receive a SIGPIPE
LyXDataSocket::~LyXDataSocket()
{
- if (close(fd_) != 0)
+ if (::close(fd_) != 0)
lyxerr << "lyx: Data socket " << fd_
<< " IO error on closing: " << strerror(errno);
int count;
// read and store characters in buffer
- while ((count = read(fd_, charbuf, charbuf_size - 1)) > 0) {
+ while ((count = ::read(fd_, charbuf, charbuf_size - 1)) > 0) {
buffer_.append(charbuf, charbuf + count);
}
{
string const linen(line + '\n');
int const size = linen.size();
- int const written = write(fd_, linen.c_str(), size);
+ int const written = ::write(fd_, linen.c_str(), size);
if (written < size) { // Always mean end of connection.
if ((written == -1) && (errno == EPIPE)) {
// The program will also receive a SIGPIPE