#include <igtlClientSocket.h>
Public Types | |
typedef SmartPointer< const Self > | ConstPointer |
typedef SmartPointer< Self > | Pointer |
typedef ClientSocket | Self |
typedef Socket | Superclass |
Public Member Functions | |
void | CloseSocket () |
igtlTypeMacro(igtl::ClientSocket, igtl::Socket) igtlNewMacro(igtl int | ConnectToServer (const char *hostname, int port) |
virtual LightObject::Pointer | CreateAnother () const |
virtual void | DebugOff () const |
virtual void | DebugOn () const |
virtual void | Delete () |
int | GetConnected () |
bool | GetDebug () const |
virtual const char * | GetNameOfClass () const |
virtual int | GetReferenceCount () const |
int | GetSocketAddressAndPort (std::string &address, int &port) |
igtlTypeMacro (Object, LightObject) | |
void | Print (std::ostream &os) const |
int | Receive (void *data, int length, int readFully=1) |
virtual void | Register () const |
int | Send (const void *data, int length) |
void | SetDebug (bool debugFlag) const |
int | SetReceiveBlocking (int sw) |
int | SetReceiveTimeout (int timeout) |
virtual void | SetReferenceCount (int) |
int | SetSendBlocking (int sw) |
int | SetSendTimeout (int timeout) |
int | SetTimeout (int timeout) |
int | Skip (int length, int skipFully=1) |
virtual void | UnRegister () const |
Static Public Member Functions | |
static void | BreakOnError () |
static Pointer | New () |
static void | SetGlobalWarningDisplay (bool flag) |
static bool | GetGlobalWarningDisplay () |
static void | GlobalWarningDisplayOn () |
static void | GlobalWarningDisplayOff () |
Protected Member Functions | |
int | Accept (int socketdescriptor) |
int | BindSocket (int socketdescriptor, int port) |
ClientSocket () | |
void | CloseSocket (int socketdescriptor) |
int | Connect (int socketdescriptor, const char *hostname, int port) |
int | CreateSocket () |
int | GetPort (int socketdescriptor) |
igtlGetMacro (SocketDescriptor, int) | |
int | Listen (int socketdescriptor) |
void | PrintSelf (std::ostream &os) const |
int | SelectSocket (int socketdescriptor, unsigned long msec) |
~ClientSocket () | |
Static Protected Member Functions | |
static int | SelectSockets (const int *sockets_to_select, int size, unsigned long msec, int *selected_index) |
Protected Attributes | |
int | m_SocketDescriptor |
Friends | |
class | ServerSocket |
virtual void | PrintHeader (std::ostream &os) const |
virtual void | PrintTrailer (std::ostream &os) const |
volatile int | m_ReferenceCount |
SimpleFastMutexLock | m_ReferenceCountLock |
Definition at line 41 of file igtlClientSocket.h.
Definition at line 47 of file igtlClientSocket.h.
Definition at line 46 of file igtlClientSocket.h.
Definition at line 44 of file igtlClientSocket.h.
Definition at line 45 of file igtlClientSocket.h.
|
protected |
|
protected |
Accept a connection on a socket. Returns -1 on error. Otherwise the descriptor of the accepted socket.
Binds socket to a particular port. Returns 0 on success other -1 is returned.
This method is called when igtlExceptionMacro executes. It allows the debugger to break on error.
|
inlineinherited |
Close the socket.
Definition at line 78 of file igtlSocket.h.
|
protectedinherited |
Connect to a server socket. Returns 0 on success, -1 on error.
igtlTypeMacro(igtl::ClientSocket, igtl::Socket) igtlNewMacro(igtl int igtl::ClientSocket::ConnectToServer | ( | const char * | hostname, |
int | port | ||
) |
Connects to host. Returns 0 on success, -1 on error.
|
virtualinherited |
Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.
Reimplemented from igtl::LightObject.
|
protectedinherited |
Creates an endpoint for communication and returns the descriptor. -1 indicates error.
Delete an igtl object. This method should always be used to delete an object when the new operator was used to create it. Using the C delete method will not work with reference counting.
|
inlineinherited |
Check is the socket is alive.
Definition at line 75 of file igtlSocket.h.
|
inherited |
Get the value of the debug flag.
Return the name of this class as a string. Used by the object factory (implemented in New()) to instantiate objects of a named type. Also used for debugging and other output information.
Definition at line 84 of file igtlLightObject.h.
Returns the port to which the socket is connected. 0 on error.
Gets the reference count on this object.
Definition at line 110 of file igtlLightObject.h.
Get socket address.
Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Definition at line 116 of file igtlObject.h.
Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Definition at line 114 of file igtlObject.h.
|
protectedinherited |
|
inherited |
Standard part of all igtl objects.
Listen for connections on a socket. Returns 0 on success. -1 on error.
Method for creation through the object factory.
|
inherited |
Cause the object to print itself out.
Number of uses of this object by other objects.
|
protectedvirtual |
Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from igtl::Object.
Number of uses of this object by other objects.
Receive data from the socket. This call blocks until some data is read from the socket, unless timeout is set by SetTimeout() or SetReceiveTimeout(). When the readFully flag is set, this call will block until all the requested data is read from the socket. The readFully flag will be ignored if the timeout is active. 0 on error, -1 on timeout, else number of bytes read is returned.
Return this objects modified time.
Update the modification time for this object. Many filters rely on the modification time to determine if they need to recompute their data.
Increase the reference count (mark as used by another object).
Reimplemented from igtl::LightObject.
Selects a socket ie. waits for it to change status. Returns 1 on success; 0 on timeout; -1 on error. msec=0 implies no timeout.
|
staticprotectedinherited |
Selects set of sockets. Returns 0 on timeout, -1 on error. 1 on success. Selected socket's index is returned thru selected_index
These methods send data over the socket. Returns 1 on success, 0 on error and raises vtkCommand::ErrorEvent. SIGPIPE or other signal may be raised on systems (e.g., Sun Solaris) where MSG_NOSIGNAL flag is not supported for the socket send method.
Set the value of the debug flag. A non-zero value turns debugging on.
This is a global flag that controls whether any debug, warning or error messages are displayed.
Set (psuedo) non-blocking mode for recv(). When sw=1, the time out is set to minimum value (1 microsecond in UNIX, 1 millisecond in Windows) for receiving.
Set reciving timeout for the existing socket in millisecond. This function should be called after opening the socket.
Sets the reference count (use with care)
Reimplemented from igtl::LightObject.
Set (psuedo) non-blocking mode for recv(). When sw=1, the time out is set to minimum value (1 microsecond in UNIX, 1 millisecond in Windows) for sending.
Set sending timeout for the existing socket in millisecond. This function should be called after opening the socket.
Set sending/receiving timeout for the existing socket in millisecond. This function should be called after opening the socket.
Skip reading data from the socket. The Skip() call has been newly introduced to the igtlSocket, after the class is imported from VTK, thus the call is not available in vtkSocket class.
Decrease the reference count (release by another object).
Reimplemented from igtl::LightObject.
|
friend |
Definition at line 61 of file igtlClientSocket.h.
Number of uses of this object by other objects.
Definition at line 131 of file igtlLightObject.h.
|
mutableprotectedinherited |
Mutex lock to protect modification to the reference count
Definition at line 134 of file igtlLightObject.h.
|
protectedinherited |
Definition at line 132 of file igtlSocket.h.