Next Previous Contents

4. Networking

4.1 Interface to socket

rtSocket defines a standard socket and provides tree important methods : void send(char *buffer, int _length);, void recv(char **buffer, int _length); and void recv(char *buffer, int _length);.

It is used as the base of following classes; they all use the TCP network protocol.

4.2 Client

rtSocketClient is used to connect to an rtSocketServer IPC server. Connection is made using the void connect(char *_addr, int _port); method.

Remember that this class inherits rtSocket.

4.3 Server

rtSocketServer can be used as IPC minimal server. It adds to the basical rtSocket methods the protected and purely virtual void handleClient(rtSocket *_socket) method.

4.4 TCP DataHandler Server

rtStreamWriterSocket waits for clients, encodes incoming data stream, and sends it to all connected clients, via different sockets.

For now, four clients can be connected simultaneously.

void handleSound(rtDataStreamBlock *block) has probably to be adapted to particular uses.

4.5 TCP DataHandler Client

rtStreamReaderSocket constructor allows connecting to any instance of type rtStreamWriterSocket, then incoming data are handled in rtDataHandler's `handle' familly methods (for instance void handleSound(rtDataStreamBlock *block)).

4.6 Session management


Next Previous Contents