C3E: Complex Compute Core Engine v1.0
An engine for handling complex computational tasks
|
Network communication utilities for the C3E library. More...
Go to the source code of this file.
Classes | |
struct | c3e_socket |
Represents a network socket for communication. More... | |
Functions | |
void | c3e_socket_init (c3e_socket *socket, const char *hostname, int port) |
Initializes a socket with the specified hostname and port. | |
void | c3e_socket_close (c3e_socket *socket) |
Closes the network socket. | |
bool | c3e_socket_send_data (c3e_socket *socket, const void *data, size_t size) |
Sends data through the socket. | |
bool | c3e_socket_receive_data (c3e_socket *socket, void *buffer, size_t size) |
Receives data from the socket. | |
void | c3e_socket_send_tensor (c3e_socket *socket, c3e_tensor *tensor) |
Sends a tensor object through the socket. | |
void | c3e_socket_send_matrix (c3e_socket *socket, c3e_matrix *matrix) |
Sends a matrix object through the socket. | |
void | c3e_socket_send_vector (c3e_socket *socket, c3e_vector *vector) |
Sends a vector object through the socket. | |
void | c3e_socket_send_number (c3e_socket *socket, c3e_number number) |
Sends a numerical value over a socket connection. | |
c3e_tensor * | c3e_socket_tensor_read (c3e_socket *socket) |
Receives and deserializes a tensor object from the socket. | |
c3e_matrix * | c3e_socket_matrix_read (c3e_socket *socket) |
Receives and deserializes a matrix object from the socket. | |
c3e_vector * | c3e_socket_vector_read (c3e_socket *socket) |
Receives and deserializes a vector object from the socket. | |
c3e_number | c3e_socket_number_read (c3e_socket *socket) |
Receives a numerical value from a socket connection. | |
This file provides functionalities for network communication within the C3E library. It includes definitions and functions for socket management, as well as sending and receiving data structures such as vectors, matrices, and tensors over a network.
void c3e_socket_close | ( | c3e_socket * | socket | ) |
This function releases the resources associated with the socket and closes the connection.
socket | A pointer to the c3e_socket structure to be closed. |
void c3e_socket_init | ( | c3e_socket * | socket, |
const char * | hostname, | ||
int | port | ||
) |
This function sets up a network socket for communication with a server. It configures the socket's address and port, and prepares it for use in sending and receiving data.
socket | A pointer to a c3e_socket structure to be initialized. |
hostname | The hostname or IP address of the server. |
port | The port number on which the server is listening. |
c3e_matrix * c3e_socket_matrix_read | ( | c3e_socket * | socket | ) |
This function reads and reconstructs a c3e_matrix
object from the data received through the network.
socket | A pointer to the c3e_socket structure used for receiving the matrix. |
c3e_matrix
object. NULL if the operation fails. c3e_number c3e_socket_number_read | ( | c3e_socket * | socket | ) |
This function reads a c3e_number
type value from the specified socket.
socket | A pointer to a c3e_socket structure representing the socket connection from which the data will be received. |
c3e_number
that was received from the socket. bool c3e_socket_receive_data | ( | c3e_socket * | socket, |
void * | buffer, | ||
size_t | size | ||
) |
This function reads data from the network through the specified socket and stores it in the provided buffer.
socket | A pointer to the c3e_socket structure used for receiving data. |
buffer | A pointer to the buffer where received data will be stored. |
size | The size of the buffer. |
true
if the data was successfully received, false
otherwise. bool c3e_socket_send_data | ( | c3e_socket * | socket, |
const void * | data, | ||
size_t | size | ||
) |
This function transmits data over the network through the specified socket.
socket | A pointer to the c3e_socket structure used for sending data. |
data | A pointer to the data to be sent. |
size | The size of the data to be sent. |
true
if the data was successfully sent, false
otherwise. void c3e_socket_send_matrix | ( | c3e_socket * | socket, |
c3e_matrix * | matrix | ||
) |
This function serializes and transmits a c3e_matrix
object over the network.
socket | A pointer to the c3e_socket structure used for sending the matrix. |
matrix | A pointer to the c3e_matrix object to be sent. |
void c3e_socket_send_number | ( | c3e_socket * | socket, |
c3e_number | number | ||
) |
This function sends a c3e_number
type value through the specified socket. It uses the c3e_socket_send_data
function to transmit the binary representation of the number.
socket | A pointer to a c3e_socket structure representing the socket connection through which the data will be sent. |
number | The numerical value of type c3e_number to be sent. This value is sent as a binary stream, which means the receiving end should be aware of the data format to correctly interpret it. |
void c3e_socket_send_tensor | ( | c3e_socket * | socket, |
c3e_tensor * | tensor | ||
) |
This function serializes and transmits a c3e_tensor
object over the network.
socket | A pointer to the c3e_socket structure used for sending the tensor. |
tensor | A pointer to the c3e_tensor object to be sent. |
void c3e_socket_send_vector | ( | c3e_socket * | socket, |
c3e_vector * | vector | ||
) |
This function serializes and transmits a c3e_vector
object over the network.
socket | A pointer to the c3e_socket structure used for sending the vector. |
vector | A pointer to the c3e_vector object to be sent. |
c3e_tensor * c3e_socket_tensor_read | ( | c3e_socket * | socket | ) |
This function reads and reconstructs a c3e_tensor
object from the data received through the network.
socket | A pointer to the c3e_socket structure used for receiving the tensor. |
c3e_tensor
object. NULL if the operation fails. c3e_vector * c3e_socket_vector_read | ( | c3e_socket * | socket | ) |
This function reads and reconstructs a c3e_vector
object from the data received through the network.
socket | A pointer to the c3e_socket structure used for receiving the vector. |
c3e_vector
object. NULL if the operation fails.