Dependencies:   mbed

Committer:
robertcook
Date:
Wed Jun 13 18:39:46 2012 +0000
Revision:
0:32a0996dff0f

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
robertcook 0:32a0996dff0f 1 #ifndef ECHO_SERVER_H
robertcook 0:32a0996dff0f 2 #define ECHO_SERVER_H
robertcook 0:32a0996dff0f 3
robertcook 0:32a0996dff0f 4 #include "mbed.h"
robertcook 0:32a0996dff0f 5 #include "TCPSocket.h"
robertcook 0:32a0996dff0f 6 #include "UDPSocket.h"
robertcook 0:32a0996dff0f 7
robertcook 0:32a0996dff0f 8 #include "TCPEchoHandler.h"
robertcook 0:32a0996dff0f 9
robertcook 0:32a0996dff0f 10 /*
robertcook 0:32a0996dff0f 11 Class: EchoServer
robertcook 0:32a0996dff0f 12 Binds itself to port 7 on TCP and UDP and listens for
robertcook 0:32a0996dff0f 13 incoming connections
robertcook 0:32a0996dff0f 14 */
robertcook 0:32a0996dff0f 15 class EchoServer {
robertcook 0:32a0996dff0f 16 public:
robertcook 0:32a0996dff0f 17 // Constructor: EchoServer
robertcook 0:32a0996dff0f 18 // Creates the TCP and UDP sockets and wires up
robertcook 0:32a0996dff0f 19 // the event callback methods
robertcook 0:32a0996dff0f 20 EchoServer();
robertcook 0:32a0996dff0f 21 // Destructor: ~EchoServer
robertcook 0:32a0996dff0f 22 // Deletes the TCP and UDP sockets
robertcook 0:32a0996dff0f 23 ~EchoServer();
robertcook 0:32a0996dff0f 24 /*
robertcook 0:32a0996dff0f 25 Function: bind
robertcook 0:32a0996dff0f 26 Binds the sockets to the specified ports
robertcook 0:32a0996dff0f 27 Parameters:
robertcook 0:32a0996dff0f 28 tcpPort - The TCP port to bind to (default 7 as per RFC862)
robertcook 0:32a0996dff0f 29 udpPort - The UDP port to bind to (default 7 as per RFC862)
robertcook 0:32a0996dff0f 30 */
robertcook 0:32a0996dff0f 31 void bind(int tcpPort=7, int udpPort=7);
robertcook 0:32a0996dff0f 32 private:
robertcook 0:32a0996dff0f 33 // Variable: tcpSock
robertcook 0:32a0996dff0f 34 // The TCP server socket
robertcook 0:32a0996dff0f 35 TCPSocket* tcpSock;
robertcook 0:32a0996dff0f 36 // Variable: udpSock
robertcook 0:32a0996dff0f 37 // The UDP socket
robertcook 0:32a0996dff0f 38 UDPSocket* udpSock;
robertcook 0:32a0996dff0f 39
robertcook 0:32a0996dff0f 40 // Function: onNetTcpSocketEvent
robertcook 0:32a0996dff0f 41 // The callback function called by the network stack whenever an
robertcook 0:32a0996dff0f 42 // event occurs on the TCP socket
robertcook 0:32a0996dff0f 43 // Parameter: e - The event that has occurred
robertcook 0:32a0996dff0f 44 void onNetTcpSocketEvent(TCPSocketEvent e);
robertcook 0:32a0996dff0f 45 // Function: onNetUdpSocketEvent
robertcook 0:32a0996dff0f 46 // The callback function called by the network stack whenever an
robertcook 0:32a0996dff0f 47 // event occurs on the UDP socket
robertcook 0:32a0996dff0f 48 // Parameter: e - The event that has occurred
robertcook 0:32a0996dff0f 49 void onNetUdpSocketEvent(UDPSocketEvent e);
robertcook 0:32a0996dff0f 50 };
robertcook 0:32a0996dff0f 51
robertcook 0:32a0996dff0f 52 #endif