Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef FLATHEADERS
00033 #include "simple_message/socket/tcp_socket.h"
00034 #include "simple_message/log_wrapper.h"
00035 #include "simple_message/simple_message.h"
00036 #include "simple_message/shared_types.h"
00037 #else
00038 #include "tcp_socket.h"
00039 #include "log_wrapper.h"
00040 #include "simple_message.h"
00041 #include "shared_types.h"
00042 #endif
00043
00044 using namespace industrial::smpl_msg_connection;
00045 using namespace industrial::byte_array;
00046 using namespace industrial::simple_message;
00047 using namespace industrial::shared_types;
00048
00049 namespace industrial
00050 {
00051 namespace tcp_socket
00052 {
00053
00054 TcpSocket::TcpSocket()
00055
00056 {
00057 this->setSockHandle(this->SOCKET_FAIL);
00058 memset(&this->sockaddr_, 0, sizeof(this->sockaddr_));
00059 this->setConnected(false);
00060
00061 }
00062
00063 TcpSocket::~TcpSocket()
00064
00065
00066 {
00067 LOG_DEBUG("Destructing TCPSocket");
00068 CLOSE(this->getSockHandle());
00069 }
00070
00071 int TcpSocket::rawSendBytes(char *buffer, shared_int num_bytes)
00072 {
00073 int rc = this->SOCKET_FAIL;
00074
00075 rc = SEND(this->getSockHandle(), buffer, num_bytes, 0);
00076
00077 return rc;
00078 }
00079
00080 int TcpSocket::rawReceiveBytes(char *buffer, shared_int num_bytes)
00081 {
00082 int rc = this->SOCKET_FAIL;
00083
00084 rc = RECV(this->getSockHandle(), buffer, num_bytes, 0);
00085
00086 return rc;
00087 }
00088
00089 }
00090 }
00091