#include <svutil.h>
Public Member Functions | |
SVNetwork (const char *hostname, int port) | |
Set up a connection to hostname on port. More... | |
~SVNetwork () | |
Destructor. More... | |
void | Send (const char *msg) |
Put a message in the messagebuffer to the server and try to send it. More... | |
char * | Receive () |
void | Close () |
Close the connection to the server. More... | |
void | Flush () |
Flush the buffer. More... | |
Private Attributes | |
SVMutex | mutex_send_ |
The mutex for access to Send() and Flush(). More... | |
int | stream_ |
The actual stream_ to the server. More... | |
char * | msg_buffer_in_ |
Stores the last received message-chunk from the server. More... | |
std::string | msg_buffer_out_ |
Stores the messages which are supposed to go out. More... | |
bool | has_content |
char * | buffer_ptr_ |
Where we are at in our msg_buffer_in_. More... | |
The SVNetwork class takes care of the remote connection for ScrollView This means setting up and maintaining a remote connection, sending and receiving messages and closing the connection. It is designed to work on both Linux and Windows.
SVNetwork::SVNetwork | ( | const char * | hostname, |
int | port | ||
) |
Set up a connection to hostname on port.
SVNetwork::~SVNetwork | ( | ) |
Destructor.
void SVNetwork::Close | ( | ) |
Close the connection to the server.
void SVNetwork::Flush | ( | ) |
Flush the buffer.
char * SVNetwork::Receive | ( | ) |
Receive a message from the server. This will always return one line of char* (denoted by
).
void SVNetwork::Send | ( | const char * | msg | ) |
Put a message in the messagebuffer to the server and try to send it.
|
private |
Where we are at in our msg_buffer_in_.
|
private |
|
private |
Stores the last received message-chunk from the server.
|
private |
Stores the messages which are supposed to go out.
|
private |
The actual stream_ to the server.