Jamoma API  0.6.0.a19
TTNetReceive.h
1 /*
2  * Jamoma Network Receiver
3  * Copyright © 2010, Tim Place
4  *
5  * License: This code is licensed under the terms of the "New BSD License"
6  * http://creativecommons.org/licenses/BSD/
7  */
8 
9 #ifndef __TT_NETRECEIVE_H__
10 #define __TT_NETRECEIVE_H__
11 
12 #include "TTFoundationAPI.h"
13 #include "TTNetSocket.h"
14 
15 
16 /** TTNetReceive is a simple server that echoes network data to a user-provided callback.
17  This code is based on the awesome tutorial @ http://beej.us/guide/bgnet/ */
20 
21 public:
22  TTUInt16 mPort; ///< port number
23  TTSymbol mMode; ///< "tcp" or "udp"
24 
25  TTNetSocketPtr mSocket;
26 
27  // internal method
28  void bind();
29 
30  /** Setter */
31  TTErr setPort(const TTValue& value);
32 
33  /** Setter */
34  TTErr setMode(const TTValue& value);
35 
36  /** Callback from socket receive */
37  TTErr networkSocketReceive(const TTValue& message, TTValue& unusedOutput);
38 
39 };
40 
41 
42 #endif // __TT_NETRECEIVE_H__
TTSymbol mMode
"tcp" or "udp"
Definition: TTNetReceive.h:23
std::uint16_t TTUInt16
16 bit unsigned integer
Definition: TTBase.h:176
TTErr setMode(const TTValue &value)
Setter.
TTDataObjectBase is the base class for all data generating and processing objects.
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
TTNetReceive is a simple server that echoes network data to a user-provided callback.
Definition: TTNetReceive.h:18
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTErr networkSocketReceive(const TTValue &message, TTValue &unusedOutput)
Callback from socket receive.
TTErr setPort(const TTValue &value)
Setter.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
TTUInt16 mPort
port number
Definition: TTNetReceive.h:22