#include <Socket.h>
Inheritance diagram for clawsoft::Socket:
Public Methods | |
Socket () | |
This is a default constructor that does nothing. | |
Socket (const char *thehost, int theport) | |
This constructor tekas as an argument the host location as an IP number or as a name, also the port to connect to, take in count that in the very moment that this class is instantiated the socket would try to connect with thw remote host inmediately. | |
Socket (TCPsocket s, int pport) | |
This constructor takes as an argument the file descriptor defined for an already opened socket, the main idea is that you can use it in a subclass so you can have the same functionality ypu do when you use the other constructors. | |
Socket (const Socket &s) | |
This is a copy constructor. | |
~Socket () | |
This destructor does nothing. | |
void | close (void) |
Closes the communications channel with the remote host inmmediately. | |
const int | getPort () |
Returns the port associated with this socket. | |
Socket & | operator<< (const char chr) |
Sends a char to the other host. | |
Socket & | operator<< (const int value) |
Sends an integer quantity to the remote host. | |
Socket & | operator<< (const unsigned int value) |
Sends an unsigned integer quantity to the remote host. | |
Socket & | operator<< (const float value) |
Sends a floating point value to the remote host. | |
Socket & | operator<< (const double value) |
Sends a double presicion value to the remote host. | |
Socket & | operator<< (const long double value) |
Sends a 96bit floating point value to the remote host. | |
Socket & | operator<< (const long value) |
Sends a long(32bit) quantity to the remote host. | |
Socket & | operator<< (const unsigned long value) |
Sends an unsigned long(32bit) quantity to the remote host. | |
Socket & | operator<< (const Uint64 value) |
Sends a 64bit unsigned quantity to the remote host. | |
Socket & | operator<< (String &str) |
Sends a string to the remote host THIS IS NOT A THREAD SAFE FUNCTION!!!!! | |
Socket & | operator<< (const char *str) |
Sends a string to the remote host. | |
void | write (const void *buffer, unsigned long size) |
Use this method when you need to send a fixed lenght buffer of bytes to the remote host, the routine will cut the buffer in chunks so the transfer can be safelly completed without out of memory error that might be caused if you attempt to send a very big buffer of data. | |
Socket & | operator>> (char &chr) |
PLEASE RECONSIDER THE USE OF SDL_Net YOU SHOULD START USING ANOTHER OS INDEPENDENT NETWORK LIBRARY. | |
Socket & | operator>> (int &value) |
Receives an integer quantity from the remote host. | |
Socket & | operator>> (unsigned int &value) |
Receives an unsigned integer quantity from the remote host. | |
Socket & | operator>> (float &value) |
Receives a floating point value from the remote host. | |
Socket & | operator>> (double &value) |
Receives a double presicion value from the remote host. | |
Socket & | operator>> (long double &value) |
Receives a 96bit floating point value from the remote host. | |
Socket & | operator>> (long &value) |
Receives a long(32bit) quantity from the remote host. | |
Socket & | operator>> (unsigned long &value) |
Receives an unsigned long(32bit) quantity from the remote host. | |
Socket & | operator>> (Uint64 &value) |
Receives a 64bit unsigned quantity from the remote host. | |
Socket & | operator>> (String &str) |
Receives a string from the remote host. | |
void | read (void *buffer, unsigned long size) |
Use this method when you need to receive a fixed lenght buffer of bytes from the remote host, the routine will cut the buffer in chunks so the transfer can be safelly completed without out of memory error that might be caused if you attempt to receive a very big buffer of data. | |
const TCPsocket | getSocket () |
Returns the socket's file descriptor value. | |
int | setSoTimeout (int) |
Defines the timeout before closing connection to the other end of communication. | |
const char * | getClassName () |
Returns the name of the current class. | |
Static Public Methods | |
int | installedCPUs () |
This will return how many CPUs are installed in the system. | |
double | cpuSpeed () |
This will return the CPU speed in megahertz. | |
int | totalMemory () |
Will return the total amount of system memory. | |
int | freeMemory () |
Will return the total amount of free system memory. | |
void | usleep (Uint32 usec) |
Will freeze the software for usec microseconds. | |
Protected Methods | |
int | CreateSocket (const char *thehost, int theport) |
This routine creates the socket by calling socket(2) and resolving the argument thehost to its IP representation in case the address is given as a name, this socket is connected to the port theport. | |
int | setSockOption (int opname, void *optval, unsigned int siz) |
Is an interface to setsockopt. | |
void | setClassName (const char *n) |
Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging. | |
Protected Attributes | |
char * | host |
Stores the hostname where the socket is going to be connected. | |
TCPsocket | tcpsock |
This file descriptor represents the socket itself as returned by socket(2) and accept(2). | |
int | port |
Defines the communications port used by the socket or the port which the socket server uses to listen requests. |
|
This is a default constructor that does nothing.
|
|
This constructor tekas as an argument the host location as an IP number or as a name, also the port to connect to, take in count that in the very moment that this class is instantiated the socket would try to connect with thw remote host inmediately.
|
|
This constructor takes as an argument the file descriptor defined for an already opened socket, the main idea is that you can use it in a subclass so you can have the same functionality ypu do when you use the other constructors.
|
|
This is a copy constructor.
|
|
This destructor does nothing.
|
|
Closes the communications channel with the remote host inmmediately.
|
|
This will return the CPU speed in megahertz.
|
|
This routine creates the socket by calling socket(2) and resolving the argument thehost to its IP representation in case the address is given as a name, this socket is connected to the port theport.
|
|
Will return the total amount of free system memory.
|
|
Returns the name of the current class.
|
|
Returns the port associated with this socket.
|
|
Returns the socket's file descriptor value.
|
|
This will return how many CPUs are installed in the system.
|
|
Sends a string to the remote host.
|
|
Sends a string to the remote host THIS IS NOT A THREAD SAFE FUNCTION!!!!!
|
|
Sends a 64bit unsigned quantity to the remote host.
|
|
Sends an unsigned long(32bit) quantity to the remote host.
|
|
Sends a long(32bit) quantity to the remote host.
|
|
Sends a 96bit floating point value to the remote host.
|
|
Sends a double presicion value to the remote host.
|
|
Sends a floating point value to the remote host.
|
|
Sends an unsigned integer quantity to the remote host.
|
|
Sends an integer quantity to the remote host.
|
|
Sends a char to the other host.
|
|
Receives a string from the remote host.
|
|
Receives a 64bit unsigned quantity from the remote host.
|
|
Receives an unsigned long(32bit) quantity from the remote host.
|
|
Receives a long(32bit) quantity from the remote host.
|
|
Receives a 96bit floating point value from the remote host.
|
|
Receives a double presicion value from the remote host.
|
|
Receives a floating point value from the remote host.
|
|
Receives an unsigned integer quantity from the remote host.
|
|
Receives an integer quantity from the remote host.
|
|
PLEASE RECONSIDER THE USE OF SDL_Net YOU SHOULD START USING ANOTHER OS INDEPENDENT NETWORK LIBRARY.
|
|
Use this method when you need to receive a fixed lenght buffer of bytes from the remote host, the routine will cut the buffer in chunks so the transfer can be safelly completed without out of memory error that might be caused if you attempt to receive a very big buffer of data.
|
|
Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.
|
|
Is an interface to setsockopt.
|
|
Defines the timeout before closing connection to the other end of communication.
|
|
Will return the total amount of system memory.
|
|
Will freeze the software for usec microseconds.
|
|
Use this method when you need to send a fixed lenght buffer of bytes to the remote host, the routine will cut the buffer in chunks so the transfer can be safelly completed without out of memory error that might be caused if you attempt to send a very big buffer of data.
|
|
Stores the hostname where the socket is going to be connected.
|
|
Defines the communications port used by the socket or the port which the socket server uses to listen requests.
|
|
This file descriptor represents the socket itself as returned by socket(2) and accept(2).
|
Authors:
Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara
Powered by: