34 lines
753 B
C
34 lines
753 B
C
#ifndef SOCKETS_LIB_H
|
|
#define SOCKETS_LIB_H
|
|
|
|
// Function to create a TCP socket
|
|
int tcp_create_socket();
|
|
|
|
// Function to connect to a server
|
|
void connect_to_server(int sock, char *ip, int port);
|
|
|
|
// Function to communicate with the server
|
|
char* communicate(int sock, char *message);
|
|
|
|
// Function to create a TCP server socket
|
|
int tcp_listen(int port);
|
|
|
|
// Function to accept a client connection
|
|
int tcp_accept(int serv_sock);
|
|
|
|
// Function to process a client request
|
|
void process_request(int clnt_sock);
|
|
|
|
|
|
int udp_create_socket();
|
|
|
|
void udp_send_message(int sock, char *server_ip, int port, char *message);
|
|
|
|
void udp_bind_socket(int sock, int port);
|
|
|
|
char* udp_receive_message(int sock);
|
|
|
|
void handle_udp_client(int serv_sock);
|
|
|
|
#endif // SOCKETS_LIB_H
|