DotNetDupe
4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Toggle main menu visibility
Loading...
Searching...
No Matches
TcpClient.h
Go to the documentation of this file.
1
5
6
#pragma once
7
8
#include "
Common.h
"
9
#include "
System/Object.h
"
10
#include "
System/String.h
"
11
#include "
System/SmartPointer.h
"
12
#include "
System/Net/Sockets/Socket.h
"
13
#include "
System/Net/Sockets/NetworkStream.h
"
14
15
namespace
DotNetDupe
{
16
namespace
System
{
17
namespace
Net
{
18
namespace
Sockets
{
19
25
class
TcpClient
:
public
Object
{
26
public
:
28
DOTNETDUPE_API
TcpClient
();
29
32
DOTNETDUPE_API
explicit
TcpClient
(
AddressFamily
family);
33
36
DOTNETDUPE_API
explicit
TcpClient
(
const
SmartPointer<Socket>
& socket);
37
39
DOTNETDUPE_API
~TcpClient
();
40
41
TcpClient
(
const
TcpClient
&) =
delete
;
42
TcpClient
&
operator=
(
const
TcpClient
&) =
delete
;
43
DOTNETDUPE_API
TcpClient
(
TcpClient
&& other)
noexcept
;
44
DOTNETDUPE_API
TcpClient
&
operator=
(
TcpClient
&& other)
noexcept
;
45
49
DOTNETDUPE_API
void
Connect
(
const
String
& ip,
int
port);
50
54
DOTNETDUPE_API
SmartPointer<NetworkStream>
GetStream
();
55
57
DOTNETDUPE_API
void
Close
();
58
61
DOTNETDUPE_API
bool
Connected
()
const
;
62
65
DOTNETDUPE_API
SmartPointer<Socket>
GetClient
()
const
;
66
69
DOTNETDUPE_API
void
SetClient
(
const
SmartPointer<Socket>
& socket);
70
71
private
:
72
SmartPointer<Socket>
m_pClientSocket;
73
SmartPointer<NetworkStream>
m_pNetworkStream;
74
};
75
76
}
77
}
78
}
79
}
Common.h
Defines common cross-platform macros, export decorators, and fundamental types.
DOTNETDUPE_API
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition
Common.h:20
NetworkStream.h
Provides the underlying stream of data for network access.
Object.h
Base object class for DotNetDupe mirroring .NET System.Object.
SmartPointer.h
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
Socket.h
Implements the Berkeley sockets interface for network communications.
String.h
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
DotNetDupe::System::Net::Sockets::TcpClient::Close
void Close()
Disposes this TcpClient instance and closes the underlying connection.
Definition
TcpClient.cpp:65
DotNetDupe::System::Net::Sockets::TcpClient::SetClient
void SetClient(const SmartPointer< Socket > &socket)
Sets the underlying Socket.
Definition
TcpClient.cpp:85
DotNetDupe::System::Net::Sockets::TcpClient::TcpClient
TcpClient()
Initializes a new instance of the TcpClient class with AddressFamily::InterNetwork.
Definition
TcpClient.cpp:10
DotNetDupe::System::Net::Sockets::TcpClient::GetStream
SmartPointer< NetworkStream > GetStream()
Returns the NetworkStream used to send and receive data.
Definition
TcpClient.cpp:52
DotNetDupe::System::Net::Sockets::TcpClient::GetClient
SmartPointer< Socket > GetClient() const
Gets the underlying Socket.
Definition
TcpClient.cpp:81
DotNetDupe::System::Net::Sockets::TcpClient::Connect
void Connect(const String &ip, int port)
Connects the client to a remote TCP host using the specified IP address and port number.
Definition
TcpClient.cpp:42
DotNetDupe::System::Net::Sockets::TcpClient::TcpClient
TcpClient(const TcpClient &)=delete
DotNetDupe::System::Net::Sockets::TcpClient::operator=
TcpClient & operator=(const TcpClient &)=delete
DotNetDupe::System::Net::Sockets::TcpClient::Connected
bool Connected() const
Gets a value indicating whether the underlying Socket for a TcpClient is connected to a remote host.
Definition
TcpClient.cpp:77
DotNetDupe::System::Object
Supports all classes in the DotNetDupe class hierarchy.
Definition
Object.h:18
DotNetDupe::System::SmartPointer
A unified smart pointer that supports both unique and shared ownership semantics.
Definition
SmartPointer.h:72
DotNetDupe::System::String
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition
String.h:74
DotNetDupe::System::Net::Sockets
Definition
HttpClient.h:20
DotNetDupe::System::Net::Sockets::AddressFamily
AddressFamily
Specifies the addressing scheme that an instance of the Socket class can use.
Definition
Socket.h:20
DotNetDupe::System::Net
Definition
Dns.h:13
DotNetDupe::System
Definition
Action.h:11
DotNetDupe
Definition
IServiceCollection.h:7
Include
System
Net
Sockets
TcpClient.h
Generated by
1.18.0