TCP communication

Dependents:   Ethernet

TCP_COMM.h

Committer:
13075593
Date:
2016-04-03
Revision:
0:6e800fc6935f
Child:
1:174bf74eba86

File content as of revision 0:6e800fc6935f:

#ifndef TCP_COMM_H
#define TCP_COMM_H

#include "mbed.h"
#include "ConfigEthernet.h"
#include <string>

#define SERVER_PORT   7

class TCP_Communication
{
    public :
        TCP_Communication(); // Établir un Thread Server pour recevoir des connexions sur MBED
        TCP_Communication(string adrr, int port); // Établir une connexion Socket à l'adresse et le port en paramètre 
        void initSocket();
        void sendDataSocket(char *data);
        void closeSocketConnection();
        
        // Thread pour la reception 
        static void threadReceiverStarter(void const *args);
        void threadReceiverWorker();
        
        // Thread pour le serveur 
        static void threadServerStarter(void const *args);
        void threadServerWorker(); 
        
    private:
        TCPSocketConnection socket;
        
        Thread threadSocket;
        char *url;
        const char *address;
        int port;
};
#endif