-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up the UDP client and server header files
- Loading branch information
1 parent
dbf79b5
commit 16f2374
Showing
7 changed files
with
72 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef __INTERCHANGE_UDP_CLIENT_H | ||
#define __INTERCHANGE_UDP_CLIENT_H | ||
|
||
#include <string> | ||
#include <queue> | ||
#include <string.h> | ||
#include <sys/types.h> | ||
#include <sys/socket.h> | ||
#include <stdio.h> //used for fprintf | ||
|
||
using namespace std; | ||
|
||
/* | ||
* @author Arushi Rai | ||
*/ | ||
|
||
class UDP_Client { | ||
private: | ||
char recipientAddr[32]; | ||
queue <string> buffer; | ||
int udp_socket; | ||
int PORT; | ||
struct sockaddr_in servaddr; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
void setup(); | ||
void bindSocket(int s, struct sockaddr_in* myaddr); | ||
void timestamp(string* data, bool add); | ||
bool validate(string data); //validates the buffer | ||
string empty(); //empties buffer | ||
|
||
public: | ||
UDP_Client(); | ||
void send(); //sends the next item in the buffer, empties it as well | ||
void addToSendBuffer(string message); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef __INTERCHANGE_UDP_SERVER_H | ||
#define __INTERCHANGE_UDP_SERVER_H | ||
|
||
#include <string> | ||
#include <queue> | ||
#include <string.h> | ||
#include <sys/types.h> | ||
#include <sys/socket.h> | ||
#include <stdio.h> //used for fprintf | ||
|
||
using namespace std; | ||
|
||
/* | ||
* @author Arushi Rai | ||
*/ | ||
|
||
class UDP_Server { | ||
private: | ||
char recipientAddr[32]; | ||
int server_socket; | ||
int PORT; | ||
queue <string> buffer; | ||
|
||
void start(); | ||
void timestamp(string* data, bool add); | ||
bool validate(string data); //validates the buffer | ||
|
||
public: | ||
UDP_Server(string address, int port); | ||
void receive(); | ||
string empty(); //empties buffer //use a more intuitive name | ||
}; | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Why does this show up like this on github? It was fine on my local copy...