Nebula
Loading...
Searching...
No Matches
stdtcpclientconnection.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
25#include "core/refcounted.h"
27#include "io/stream.h"
28#include "net/socket/socket.h"
29
30//------------------------------------------------------------------------------
31namespace Net
32{
34{
36public:
42 virtual bool Connect(const Ptr<Socket>& s);
44 bool IsConnected() const;
46 virtual void Shutdown();
48 const IpAddress& GetClientAddress() const;
50 virtual Socket::Result Send();
52 virtual Socket::Result Send(const Ptr<IO::Stream>& stream);
54 virtual const Ptr<IO::Stream>& GetSendStream();
56 virtual Socket::Result Recv();
58 virtual const Ptr<IO::Stream>& GetRecvStream();
59
60protected:
64};
65
66} // namespace Net
67//------------------------------------------------------------------------------
The common base class of Nebula.
Definition refcounted.h:38
Represents an IP address, consisting of a IPv4 host address and a port number.
A TcpClientConnection represents a connected TcpClient on the server side.
Definition stdtcpclientconnection.h:34
Ptr< IO::Stream > sendStream
Definition stdtcpclientconnection.h:62
const IpAddress & GetClientAddress() const
get the client's ip address
Definition stdtcpclientconnection.cc:93
StdTcpClientConnection()
constructor
Definition stdtcpclientconnection.cc:20
virtual Socket::Result Send()
send accumulated content of send stream to server
Definition stdtcpclientconnection.cc:146
virtual ~StdTcpClientConnection()
destructor
Definition stdtcpclientconnection.cc:28
virtual bool Connect(const Ptr< Socket > &s)
connect using provided socket
Definition stdtcpclientconnection.cc:37
virtual const Ptr< IO::Stream > & GetRecvStream()
access to recv stream
Definition stdtcpclientconnection.cc:211
__DeclareClass(StdTcpClientConnection)
virtual Socket::Result Recv()
receive data from server into recv stream
Definition stdtcpclientconnection.cc:158
virtual const Ptr< IO::Stream > & GetSendStream()
access to send stream
Definition stdtcpclientconnection.cc:202
virtual void Shutdown()
shutdown the connection
Definition stdtcpclientconnection.cc:78
Ptr< Socket > socket
Definition stdtcpclientconnection.h:61
Ptr< IO::Stream > recvStream
Definition stdtcpclientconnection.h:63
bool IsConnected() const
get the connection status
Definition stdtcpclientconnection.cc:62
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Definition debugmessage.h:20