Bibliotheques TP RT  1.0
Bibliotheque de support pour TP/RT
server.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 dimercur
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
26 #ifndef _SERVER_H_
27 #define _SERVER_H_
28 
29 #include "image.h"
30 #define DEFAULT_SERVER_PORT 2323
31 
38 int openServer (int port);
39 
45 int closeServer();
46 
52 int acceptClient();
53 
62 int sendDataToServer(char *data, int length);
63 
73 int sendDataToServerForClient(int client, char *data, int length);
74 
83 int receiveDataFromServer(char *data, int size);
84 
94 int receiveDataFromServerFromClient(int client, char *data, int size);
95 
103 int sendImage(Jpg *image);
104 #endif /* _SERVER_H_ */
105 
int openServer(int port)
Open server port, connect and listen to given port.
Functions for image treatment.
int closeServer()
Close server.
int sendImage(Jpg *image)
Send image to monitor using default client ID.
vector< unsigned char > Jpg
Definition: image.h:67
int receiveDataFromServerFromClient(int client, char *data, int size)
Read data from monitor, using specific client ID.
int receiveDataFromServer(char *data, int size)
Read data from monitor.
int sendDataToServer(char *data, int length)
Send given data to monitor.
int sendDataToServerForClient(int client, char *data, int length)
Send given data to monitor, using specific client ID.
int acceptClient()
Wait for a client to connect.