-
Notifications
You must be signed in to change notification settings - Fork 0
/
IPV4Socket.hh
31 lines (28 loc) · 1.05 KB
/
IPV4Socket.hh
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
#pragma once
#include "Socket.hh"
#include <cstdint>
#include <string>
/*
IPV4Socket represents a socket connection that is portable between all platforms.
The code must all be encapsulated in IPV4Socket.cc and hides any implementation details
This implementation uses TCP/IP sockets.
Eventually a corresponding class UDP4Socket will be written for faster Datagrams without
acknowledgement and a guaranteed delivery system will have to be written on top of that.
Header files are being moved to .cc so external code does not have to deal with the
large includes as well as the system specific nature of those includes
*/
class IPV4Socket : public Socket {
private:
long long unsigned int sckt;
public:
IPV4Socket(const char* addr, uint16_t port); //Client
IPV4Socket(uint16_t port); // Server
~IPV4Socket();
void listenOnPort();
// void send(const char data[], size_t bytes);
// size_t receive(char data[], size_t bytes);
void wait();
void send(const char* command); // For HTTP
void send(uint32_t reqn);
void sendAndAwait(uint32_t reqn, Request& r);
};