Public Methods |
| CAVERNnet_udp_c () |
void | enableInstrumentation () |
void | disableInstrumentation () |
void | setTimeOut (int t) |
int | getTimeOut () |
| Get timeout period.
|
int | init (unsigned short port=0) |
int | setSendAddress (char *host, unsigned short port) |
void | copyReceiveAddressToSendAddress () |
CAVERNnet_udp_c* | clone () |
int | send (char *message, int length, int blockingType=CAVERNnet_udp_c::NULL_VALUE) |
int | receive (char *message, int length, int blockingType=CAVERNnet_udp_c::NULL_VALUE) |
int | peek (char *message, int length) |
void | makeNonBlocking () |
| Make a connection non blocking (This method is being phased out of the distribution - you can set the blocking type in send() or receive() directly).
|
void | printInfo () |
| Print information on the connection (IP address, port number etc).
|
void | close () |
void | showStats (char *streamInfo, char *comment) |
int | logStats (char *streamInfo, char *comment, FILE *filePtr) |
int | sendStats (char *streamInfo, char *comment) |
int | initSendStats (char *monitorClientIP, int port=PERF_DAEMON_DEFAULT_PORT) |
void | exitSendStats () |
|
unsigned long | getReceiveIP () |
| Get an incoming packet's originating address.
|
void | getReceiveIP (char *ip) |
| Get an incoming packet's originating address.
|
unsigned short | getReceivePort () |
| Get an incoming packet's originating port.
|
unsigned long | getSendIP () |
| Get outgoing packet's destination address.
|
void | getSendIP (char *ip) |
| Get outgoing packet's destination address.
|
unsigned short | getSendPort () |
| Get outgoing packet's destination port.
|
unsigned long | getSelfIP () |
| Get your own IP.
|
void | getSelfIP (char *ip) |
| Get your own IP.
|
unsigned short | getSelfPort () |
| Get your own port.
|
Static Public Attributes |
|
const int | OK |
| Status ok.
|
const int | FAILED |
| Status failed.
|
|
const int | BLOCKING |
| Make the connection blocking but timeout eventually.
|
const int | NON_BLOCKING |
| Make the connection non blocking.
|
const int | NULL_VALUE |
| Default value used for the send() and receive().
|
|
const int | NO_TIME_OUT |
| Used to set time out period to never time out.
|
const int | DEFAULT_TIME_OUT |
| Default time out is no time out.
|
|
const int | SOCKET_NOT_OPEN |
| Socket is not open.
|
const int | TIMED_OUT |
| The read/write timed out.
|
const int | NON_BLOCKING_NOT_READY_TO_WRITE |
| You attempted to write with non blocking and socket was not ready.
|
const int | NON_BLOCKING_HAS_NO_DATA |
| You attempted to read with non blocking and there was no data.
|
Private Attributes |
int | enableInstr |
int | sockfd |
int | timeOutStatus |
int | timeOutPeriod |
struct sockaddr_in selfAddress
sendAddress | receiveAddress |
CAVERNnet_perfMonitor_c | pmonitor |
int | typeOfBlocking |
To send data to a destination you need to set the destination with the SetSendAddress method and then call the Send method.
To receive data, simply call the Receive method.
By default the connections are BLOCKING, which means, if you call Receive and there is no data available to read your program will block until something comes along. To make your receives or sends non blocking, use the NON_BLOCKING flag as a parameter to the receive() or send().In the previous versions the makeNonBlocking() method was used. The makeNonBlocking() is being phased out.