Files
CPP/sstp/clientsocketsender.hpp

38 lines
1.0 KiB
C++

#ifndef _SSTP_CLIENTSOCKETSENDER_HPP_
#define _SSTP_CLIENTSOCKETSENDER_HPP_
#include <stdio.h>
#include <iostream>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <thread>
#include <common/string.hpp>
#include <common/profiler.hpp>
#include <common/block.hpp>
#include <common/fileio.hpp>
class ClientSocketSender
{
public:
ClientSocketSender();
ClientSocketSender(String ipAddress,int port);
virtual ~ClientSocketSender();
bool sendFile(String &pathFileName);
bool isOkay(void);
private:
static constexpr int BUFFER_LENGTH=1048576; // This buffer length is used for both reading the file and also the packet transmission length
void close(void);
bool sendPacketIndicator(DWORD bytesToSend);
bool sendPacket(Array<char> &buffer,DWORD bytesToSend);
bool sendPutIndicator(String fileName,DWORD fileLength);
bool sendQuit(void);
struct sockaddr_in mInternalSocketAddress;
int mSocket;
String mIPAddress;
int mPort;
};
#endif