TCP communication

Dependents:   Ethernet

Committer:
13075593
Date:
Mon Apr 04 22:04:28 2016 +0000
Revision:
1:174bf74eba86
Parent:
0:6e800fc6935f
Communication TCP/IP

Who changed what in which revision?

UserRevisionLine numberNew contents of line
13075593 0:6e800fc6935f 1 #ifndef TCP_COMM_H
13075593 0:6e800fc6935f 2 #define TCP_COMM_H
13075593 1:174bf74eba86 3 #include "rtos.h"
13075593 0:6e800fc6935f 4 #include "mbed.h"
13075593 0:6e800fc6935f 5 #include "ConfigEthernet.h"
13075593 0:6e800fc6935f 6 #include <string>
13075593 0:6e800fc6935f 7
13075593 0:6e800fc6935f 8 #define SERVER_PORT 7
13075593 0:6e800fc6935f 9
13075593 0:6e800fc6935f 10 class TCP_Communication
13075593 0:6e800fc6935f 11 {
13075593 0:6e800fc6935f 12 public :
13075593 1:174bf74eba86 13 TCP_Communication();
13075593 0:6e800fc6935f 14 TCP_Communication(string adrr, int port); // Établir une connexion Socket à l'adresse et le port en paramètre
13075593 0:6e800fc6935f 15 void initSocket();
13075593 0:6e800fc6935f 16 void sendDataSocket(char *data);
13075593 0:6e800fc6935f 17 void closeSocketConnection();
13075593 0:6e800fc6935f 18
13075593 0:6e800fc6935f 19 // Thread pour la reception
13075593 0:6e800fc6935f 20 static void threadReceiverStarter(void const *args);
13075593 0:6e800fc6935f 21 void threadReceiverWorker();
13075593 0:6e800fc6935f 22
13075593 0:6e800fc6935f 23 // Thread pour le serveur
13075593 0:6e800fc6935f 24 static void threadServerStarter(void const *args);
13075593 0:6e800fc6935f 25 void threadServerWorker();
13075593 0:6e800fc6935f 26
13075593 0:6e800fc6935f 27 private:
13075593 0:6e800fc6935f 28 TCPSocketConnection socket;
13075593 0:6e800fc6935f 29
13075593 0:6e800fc6935f 30 Thread threadSocket;
13075593 1:174bf74eba86 31
13075593 0:6e800fc6935f 32 char *url;
13075593 0:6e800fc6935f 33 const char *address;
13075593 0:6e800fc6935f 34 int port;
13075593 0:6e800fc6935f 35 };
13075593 0:6e800fc6935f 36 #endif