Belle II Software development
EvtSocketRecv Class Reference

Public Member Functions

 EvtSocketRecv (int port, bool accept_at_init=true)
 
int status ()
 
int send (EvtMessage *msg)
 
EvtMessagerecv (void)
 
int send_buffer (int size, char *buf)
 
int recv_buffer (char *buf)
 
SocketRecvsock (void)
 

Private Attributes

SocketRecvm_sock
 
char * m_recbuf
 

Detailed Description

Definition at line 47 of file EvtSocket.h.

Constructor & Destructor Documentation

◆ EvtSocketRecv()

EvtSocketRecv ( int  port,
bool  accept_at_init = true 
)

Definition at line 67 of file EvtSocket.cc.

68{
69 m_sock = new SocketRecv((u_short)port);
70 m_recbuf = new char[MAXEVTSIZE];
71 if (accept_at_init)
72 m_sock->accept();
73}

◆ ~EvtSocketRecv()

Definition at line 75 of file EvtSocket.cc.

76{
77 delete m_sock;
78 delete[] m_recbuf;
79}

Member Function Documentation

◆ recv()

EvtMessage * recv ( void  )

Definition at line 81 of file EvtSocket.cc.

82{
83 int stat = m_sock->get(m_recbuf, MAXEVTSIZE);
84 if (stat <= 0) return NULL;
85 EvtMessage* evt = new EvtMessage(m_recbuf);
86 // delete [] evtbuf;
87 return evt;
88}
Class to manage streamed object.
Definition: EvtMessage.h:59

◆ recv_buffer()

int recv_buffer ( char *  buf)

Definition at line 100 of file EvtSocket.cc.

101{
102 int stat = m_sock->get(buf, MAXEVTSIZE);
103 return stat;
104}

◆ send()

int send ( EvtMessage msg)

Definition at line 90 of file EvtSocket.cc.

91{
92 return m_sock->put((char*)msg->buffer(), msg->size());
93}
char * buffer()
Get buffer address.
Definition: EvtMessage.cc:76
int size() const
Get size of message including headers.
Definition: EvtMessage.cc:94

◆ send_buffer()

int send_buffer ( int  size,
char *  buf 
)

Definition at line 95 of file EvtSocket.cc.

96{
97 return m_sock->put(buf, nbytes);
98}

◆ sock()

SocketRecv * sock ( void  )

Definition at line 106 of file EvtSocket.cc.

107{
108 return m_sock;
109}

Member Data Documentation

◆ m_recbuf

char* m_recbuf
private

Definition at line 64 of file EvtSocket.h.

◆ m_sock

SocketRecv* m_sock
private

Definition at line 63 of file EvtSocket.h.


The documentation for this class was generated from the following files: