1 /* Copyright (c) 2015-2016. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #include <sys/types.h>
11 #include <sys/socket.h>
15 #include "src/mc/Channel.hpp"
17 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_Channel, mc, "MC interprocess communication");
24 if (this->socket_ >=0)
28 int Channel::send(const void* message, size_t size) const
30 XBT_DEBUG("Protocol [%s] send %s",
31 MC_mode_name(mc_mode),
32 MC_message_type_name(*(e_mc_message_type*) message));
34 while (::send(this->socket_, message, size, 0) == -1)
42 ssize_t Channel::receive(void* message, size_t size, bool block) const
44 int res = recv(this->socket_, message, size, block ? 0 : MSG_DONTWAIT);
46 XBT_DEBUG("Protocol [%s] received %s",
47 MC_mode_name(mc_mode),
48 MC_message_type_name(*(e_mc_message_type*) message));