blob: ef9cf4c8f539a2a1f20843655eae82ba70f99211 [file] [log] [blame]
Alexander Afanasyev11225012013-11-21 23:11:10 -08001TcpTransport.ConnectionInfo Class
2=================================
3
4:[C++]:
5 Namespace: ndn
6
7A TcpTransport::ConnectionInfo extends Transport::ConnectionInfo to hold the host and port info for the TCP connection.
8
9TcpTransport.ConnectionInfo Constructor
10---------------------------------------
11
12Create a TcpTransport.ConnectionInfo with the given host and port.
13
14:[C++]:
15
16 .. code-block:: c++
17
18 TcpTransport(
19
20 const char *host
21 [, unsigned short port]
22
23 );
24
25:Parameters:
26
27 - `host`
28 The host for the connection.
29
30 - `port`
31 (optional) The port number for the connection. If omitted, use 9695.
32
33.. _TcpTransport:
34
35TcpTransport Class
36==================
37
38:[C++]:
39
40Namespace: `ndn`
41
42TcpTransport Constructor
43------------------------
44
45Create a TcpTransport which extends the Transport interface to implement communication over TCP/IP.
46
47:[C++]:
48
49 .. code-block:: c++
50
51 TcpTransport();
52
53:[JavaScript]:
54
55 .. code-block:: javascript
56
57 var TcpTransport = function TcpTransport()
58
59TcpTransport.connect Method
60---------------------------
61
62Connect according to the info in ConnectionInfo, and use elementListener to receive data.
63
64:[C++]:
65
66 .. code-block:: c++
67
68 void connect(
69
70 const Transport::ConnectionInfo& connectionInfo,
71 ElementListener& elementListener
72
73 );
74
75:[JavaScript]:
76
77 .. code-block:: javascript
78
79 TcpTransport.prototype.connect = function(
80
81 ndn // NDN
82
83 )
84
85:Parameters:
86
87 - `connectionInfo`
88 A TcpTransport.ConnectionInfo with the info for connecting.
89
90 - `elementListener`
91 The ElementListener called when an element is received.
92
93TcpTransport.send Method
94------------------------
95
96Send the data over the connection.
97
98:[C++]:
99
100 .. code-block:: c++
101
102 void send(
103
104 const uint8_t* data,
105 size_t dataLength
106
107 );
108
109:[JavaScript]:
110
111 .. code-block:: javascript
112
113 TcpTransport.prototype.send = function(
114
115 data // Uint8Array
116
117 )
118
119:Parameters:
120
121 - `data`
122 The data byte array to send.
123
124 - `dataLength`
125 (C++ only) The length of the data byte array.