A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
ns3tcp-socket-writer.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010 University of Washington
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*/
6
7
#include "ns3/address.h"
8
#include "ns3/application.h"
9
#include "ns3/node.h"
10
#include "ns3/ptr.h"
11
#include "ns3/socket.h"
12
13
namespace
ns3
14
{
15
16
/**
17
* \ingroup system-tests-tcp
18
*
19
* \brief Simple class to write data to sockets.
20
*/
21
class
SocketWriter
:
public
Application
22
{
23
public
:
24
SocketWriter
();
25
~SocketWriter
()
override
;
26
/**
27
* Register this type.
28
* \return The TypeId.
29
*/
30
static
TypeId
GetTypeId
();
31
32
/**
33
* Setup the socket.
34
* \param node The node owning the socket.
35
* \param peer The destination address.
36
*/
37
void
Setup
(
Ptr<Node>
node,
Address
peer);
38
/**
39
* Connect the socket.
40
*/
41
void
Connect
();
42
/**
43
* Write to the socket.
44
* \param numBytes The number of bytes to write.
45
*/
46
void
Write
(
uint32_t
numBytes);
47
/**
48
* Close the socket.
49
*/
50
void
Close
();
51
52
private
:
53
void
StartApplication
()
override
;
54
void
StopApplication
()
override
;
55
Address
m_peer
;
//!< Peer's address.
56
Ptr<Node>
m_node
;
//!< Node pointer
57
Ptr<Socket>
m_socket
;
//!< Socket.
58
bool
m_isSetup
;
//!< True if the socket is connected.
59
bool
m_isConnected
;
//!< True if the socket setup has been done.
60
};
61
}
// namespace ns3
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::Application
The base class for all ns3 applications.
Definition
application.h:51
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::SocketWriter
Simple class to write data to sockets.
Definition
ns3tcp-socket-writer.h:22
ns3::SocketWriter::m_peer
Address m_peer
Peer's address.
Definition
ns3tcp-socket-writer.h:55
ns3::SocketWriter::SocketWriter
SocketWriter()
Definition
ns3tcp-socket-writer.cc:15
ns3::SocketWriter::~SocketWriter
~SocketWriter() override
Definition
ns3tcp-socket-writer.cc:23
ns3::SocketWriter::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
ns3tcp-socket-writer.cc:31
ns3::SocketWriter::Connect
void Connect()
Connect the socket.
Definition
ns3tcp-socket-writer.cc:61
ns3::SocketWriter::Setup
void Setup(Ptr< Node > node, Address peer)
Setup the socket.
Definition
ns3tcp-socket-writer.cc:53
ns3::SocketWriter::Write
void Write(uint32_t numBytes)
Write to the socket.
Definition
ns3tcp-socket-writer.cc:72
ns3::SocketWriter::m_node
Ptr< Node > m_node
Node pointer.
Definition
ns3tcp-socket-writer.h:56
ns3::SocketWriter::Close
void Close()
Close the socket.
Definition
ns3tcp-socket-writer.cc:83
ns3::SocketWriter::m_isSetup
bool m_isSetup
True if the socket is connected.
Definition
ns3tcp-socket-writer.h:58
ns3::SocketWriter::StopApplication
void StopApplication() override
Application specific shutdown code.
Definition
ns3tcp-socket-writer.cc:48
ns3::SocketWriter::m_socket
Ptr< Socket > m_socket
Socket.
Definition
ns3tcp-socket-writer.h:57
ns3::SocketWriter::m_isConnected
bool m_isConnected
True if the socket setup has been done.
Definition
ns3tcp-socket-writer.h:59
ns3::SocketWriter::StartApplication
void StartApplication() override
Application specific startup code.
Definition
ns3tcp-socket-writer.cc:41
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
test
ns3tcp
ns3tcp-socket-writer.h
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0