A Discrete-Event Network Simulator
API
ns3tcp-socket-writer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 University of Washington
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  */
17 
18 #include "ns3/address.h"
19 #include "ns3/application.h"
20 #include "ns3/node.h"
21 #include "ns3/ptr.h"
22 #include "ns3/socket.h"
23 
24 namespace ns3
25 {
26 
32 class SocketWriter : public Application
33 {
34  public:
35  SocketWriter();
36  ~SocketWriter() override;
41  static TypeId GetTypeId();
42 
48  void Setup(Ptr<Node> node, Address peer);
52  void Connect();
57  void Write(uint32_t numBytes);
61  void Close();
62 
63  private:
64  void StartApplication() override;
65  void StopApplication() override;
69  bool m_isSetup;
71 };
72 } // namespace ns3
a polymophic address class
Definition: address.h:101
The base class for all ns3 applications.
Definition: application.h:62
Simple class to write data to sockets.
Address m_peer
Peer's address.
static TypeId GetTypeId()
Register this type.
void Connect()
Connect the socket.
void Setup(Ptr< Node > node, Address peer)
Setup the socket.
void Write(uint32_t numBytes)
Write to the socket.
Ptr< Node > m_node
Node pointer.
void Close()
Close the socket.
bool m_isSetup
True if the socket is connected.
void StopApplication() override
Application specific shutdown code.
Ptr< Socket > m_socket
Socket.
bool m_isConnected
True if the socket setup has been done.
void StartApplication() override
Application specific startup code.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.