-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUdp.h
56 lines (50 loc) · 2.44 KB
/
Udp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/************************************************************
* File description: UDP header file. the class inherit from *
* socket. methods of udp socket type *
************************************************************/
#ifndef UDP_H_
#define UDP_H_
#include "Socket.h"
class Udp: public Socket {
public:
/***********************************************************************
* function name: Udp *
* The Input: Boolean, true - if server, false if client and port number*
* The output: none *
* The Function operation: creating new Udp *
***********************************************************************/
Udp(bool isServers, int port_num, string ip);
/***********************************************************************
* function name: ~Udp *
* The Input: none *
* The output: none *
* The Function operation: default destructor *
***********************************************************************/
virtual ~Udp();
/***********************************************************************
* function name: initialize *
* The Input: none *
* The output: int number representing the return status *
* The Function operation: initialize the Socket object and getting a *
* socket descriptor. *
***********************************************************************/
int initialize();
/***********************************************************************
* function name: sendData *
* The Input: string representing the data to send *
* The output: int number representing the return status *
* The Function operation: sending the input data to the socket *
* who connect to this socket. *
***********************************************************************/
int sendData(string data, int);
/***********************************************************************
* function name: recive ` *
* The Input: none *
* The output: int number representing the return status *
* The Function operation: getting data from the other socket and print *
* the data *
***********************************************************************/
int reciveData(char* buffer, int size, int);
int acceptSock();
};
#endif /* UDP_H_ */