This is our abstract base class that hides the platform specific socket implementation 更多...
#include <Sockets.h>
Public 成员函数 | |
| virtual class FSocket * | Accept (const FString &InSocketDescription)=0 |
| Accepts a connection that is pending. 更多... | |
| virtual class FSocket * | Accept (FInternetAddr &OutAddr, const FString &InSocketDescription)=0 |
| Accepts a connection that is pending. 更多... | |
| virtual bool | Bind (const FInternetAddr &Addr)=0 |
| Binds a socket to a network byte ordered address. 更多... | |
| virtual bool | Close ()=0 |
| Closes the socket 更多... | |
| virtual bool | Connect (const FInternetAddr &Addr)=0 |
| Connects a socket to a network byte ordered address. 更多... | |
| FSocket () | |
| Default constructor. | |
| FSocket (ESocketType InSocketType, const FString &InSocketDescription) | |
| Specifies the type of socket being created 更多... | |
| FSocket (ESocketType InSocketType, const FString &InSocketDescription, const FName &InSocketProtocol) | |
| Specifies the type of socket being created 更多... | |
| virtual void | GetAddress (FInternetAddr &OutAddr)=0 |
| Reads the address the socket is bound to and returns it. 更多... | |
| virtual ESocketConnectionState | GetConnectionState ()=0 |
| Determines the connection state of the socket. 更多... | |
| FORCEINLINE FString | GetDescription () const |
| Get the debug description of the socket. 更多... | |
| virtual bool | GetPeerAddress (FInternetAddr &OutAddr)=0 |
| Reads the address of the peer the socket is connected to. 更多... | |
| virtual int32 | GetPortNo ()=0 |
| Reads the port this socket is bound to. 更多... | |
| FORCEINLINE FName | GetProtocol () const |
| Get the type of protocol the socket is bound to 更多... | |
| FORCEINLINE ESocketType | GetSocketType () const |
| Get the type of protocol the socket is bound to 更多... | |
| bool | HasPendingConnection (bool &bHasPendingConnection) |
| Queries the socket to determine if there is a pending connection. 更多... | |
| virtual bool | HasPendingData (uint32 &PendingDataSize)=0 |
| Queries the socket to determine if there is pending data on the queue. 更多... | |
| virtual bool | JoinMulticastGroup (const FInternetAddr &GroupAddress)=0 |
| Joins this socket to the specified multicast group. 更多... | |
| virtual bool | JoinMulticastGroup (const FInternetAddr &GroupAddress, const FInternetAddr &InterfaceAddress)=0 |
| Joins this socket to the specified multicast group on the specified interface. 更多... | |
| virtual bool | LeaveMulticastGroup (const FInternetAddr &GroupAddress)=0 |
| Removes this UDP client from the specified multicast group. 更多... | |
| virtual bool | LeaveMulticastGroup (const FInternetAddr &GroupAddress, const FInternetAddr &InterfaceAddress)=0 |
| Removes this UDP client from the specified multicast group on the specified interface. 更多... | |
| virtual bool | Listen (int32 MaxBacklog)=0 |
| Places the socket into a state to listen for incoming connections. 更多... | |
| virtual bool | Recv (uint8 *Data, int32 BufferSize, int32 &BytesRead, ESocketReceiveFlags::Type Flags=ESocketReceiveFlags::None) |
| Reads a chunk of data from a connected socket 更多... | |
| virtual bool | RecvFrom (uint8 *Data, int32 BufferSize, int32 &BytesRead, FInternetAddr &Source, ESocketReceiveFlags::Type Flags=ESocketReceiveFlags::None) |
| Reads a chunk of data from the socket and gathers the source address. 更多... | |
| virtual bool | RecvMulti (FRecvMulti &MultiData, ESocketReceiveFlags::Type Flags=ESocketReceiveFlags::None) |
| Reads multiple packets from the socket at once, gathering the source address and other optional platform specific data. 更多... | |
| virtual bool | Send (const uint8 *Data, int32 Count, int32 &BytesSent) |
| Sends a buffer on a connected socket. 更多... | |
| virtual bool | SendTo (const uint8 *Data, int32 Count, int32 &BytesSent, const FInternetAddr &Destination) |
| Sends a buffer to a network byte ordered address. 更多... | |
| virtual bool | SetBroadcast (bool bAllowBroadcast=true)=0 |
| Sets a socket into broadcast mode (UDP only). 更多... | |
| virtual bool | SetLinger (bool bShouldLinger=true, int32 Timeout=0)=0 |
| Sets whether and how long a socket will linger after closing. 更多... | |
| virtual bool | SetMulticastInterface (const FInternetAddr &InterfaceAddress)=0 |
| Sets the interface used to send outgoing multicast datagrams. 更多... | |
| virtual bool | SetMulticastLoopback (bool bLoopback)=0 |
| Enables or disables multicast loopback on the socket (UDP only). 更多... | |
| virtual bool | SetMulticastTtl (uint8 TimeToLive)=0 |
| Sets the time to live (TTL) for multicast datagrams. 更多... | |
| virtual bool | SetNoDelay (bool bIsNoDelay=true)=0 |
| Sets this socket into TCP_NODELAY mode (TCP only). 更多... | |
| virtual bool | SetNonBlocking (bool bIsNonBlocking=true)=0 |
| Sets this socket into non-blocking mode. 更多... | |
| virtual bool | SetReceiveBufferSize (int32 Size, int32 &NewSize)=0 |
| Sets the size of the receive buffer to use. 更多... | |
| virtual bool | SetRecvErr (bool bUseErrorQueue=true)=0 |
| Enables error queue support for the socket. 更多... | |
| virtual bool | SetRetrieveTimestamp (bool bRetrieveTimestamp=true) |
| Sets whether to retrieve the system-level receive timestamp, for sockets 更多... | |
| virtual bool | SetReuseAddr (bool bAllowReuse=true)=0 |
| Sets whether a socket can be bound to an address in use. 更多... | |
| virtual bool | SetSendBufferSize (int32 Size, int32 &NewSize)=0 |
| Sets the size of the send buffer to use. 更多... | |
| virtual bool | Shutdown (ESocketShutdownMode Mode)=0 |
| Shuts down the socket, making it unusable for reads and/or writes. 更多... | |
| virtual bool | Wait (ESocketWaitConditions::Type Condition, FTimespan WaitTime)=0 |
| Blocks until the specified condition is met. 更多... | |
| virtual bool | WaitForPendingConnection (bool &bHasPendingConnection, const FTimespan &WaitTime)=0 |
| Waits for a pending connection on the socket. 更多... | |
| virtual | ~FSocket () |
| Virtual destructor. | |
Protected 属性 | |
| FString | SocketDescription |
| Debug description of socket usage. | |
| FName | SocketProtocol |
| Protocol used in creation of a socket | |
| const ESocketType | SocketType |
| Indicates the type of socket this is | |
This is our abstract base class that hides the platform specific socket implementation
|
inline |
Specifies the type of socket being created
| InSocketType | The type of socket being created |
| InSocketDescription | The debug description of the socket |
|
inline |
Specifies the type of socket being created
| InSocketType | The type of socket being created |
| InSocketDescription | The debug description of the socket |
| InSocketProtocol | the protocol stack this socket should be created on. |
Accepts a connection that is pending.
| SocketDescription | Debug description of socket, |
|
pure virtual |
Accepts a connection that is pending.
| OutAddr | The address of the connection. |
| SocketDescription | Debug description of socket. |
|
pure virtual |
Binds a socket to a network byte ordered address.
| Addr | The address to bind to. |
|
pure virtual |
Closes the socket
|
pure virtual |
Connects a socket to a network byte ordered address.
| Addr | The address to connect to. |
|
pure virtual |
Reads the address the socket is bound to and returns it.
| OutAddr | The address the socket is bound to. |
|
pure virtual |
Determines the connection state of the socket.
|
inline |
|
pure virtual |
Reads the address of the peer the socket is connected to.
| OutAddr | Address of the peer the socket is connected to. |
|
pure virtual |
|
inline |
|
inline |
|
inline |
Queries the socket to determine if there is a pending connection.
| bHasPendingConnection | Will indicate whether a connection is pending or not. |
|
pure virtual |
Queries the socket to determine if there is pending data on the queue.
| PendingDataSize | Will indicate how much data is on the pipe for a single recv call. |
|
pure virtual |
Joins this socket to the specified multicast group.
The multicast group address must be in the range 224.0.0.0 to 239.255.255.255.
| GroupAddress | The IP address of the multicast group. |
|
pure virtual |
Joins this socket to the specified multicast group on the specified interface.
The multicast group address must be in the range 224.0.0.0 to 239.255.255.255.
| GroupAddress | The IP address of the multicast group. |
| InterfaceAddress | The address representing the interface. |
|
pure virtual |
Removes this UDP client from the specified multicast group.
| The | multicast group address to leave. |
|
pure virtual |
Removes this UDP client from the specified multicast group on the specified interface.
| GroupAddress | The multicast group address to leave. |
| InterfaceAddress | The address representing the interface. |
|
pure virtual |
Places the socket into a state to listen for incoming connections.
| MaxBacklog | The number of connections to queue before refusing them. |
|
virtual |
Reads a chunk of data from a connected socket
A return value of 'true' does not necessarily mean that data was returned. Callers must check the 'BytesRead' parameter for the actual amount of data returned. A value of zero indicates that there was no data available for reading.
| Data | The buffer to read into |
| BufferSize | The max size of the buffer |
| BytesRead | Will indicate how many bytes were read from the socket |
| Flags | the receive flags |
|
virtual |
Reads a chunk of data from the socket and gathers the source address.
A return value of 'true' does not necessarily mean that data was returned. Callers must check the 'BytesRead' parameter for the actual amount of data returned. A value of zero indicates that there was no data available for reading.
| Data | The buffer to read into. |
| BufferSize | The max size of the buffer. |
| BytesRead | Will indicate how many bytes were read from the socket. |
| Source | Will contain the receiving the address of the sender of the data. |
| Flags | The receive flags. |
|
virtual |
Reads multiple packets from the socket at once, gathering the source address and other optional platform specific data.
Use ISocketSubsystem::IsSocketRecvMultiSupported to check if the current socket platform supports this. NOTE: For optimal performance, one FRecvMulti instance should be used, for the lifetime of the socket.
| MultiData | The FRecvMulti instance that receives packet data and holds platform specific buffers for receiving data. |
| Flags | The receive flags. |
|
virtual |
Sends a buffer on a connected socket.
| Data | The buffer to send. |
| Count | The size of the data to send. |
| BytesSent | Will indicate how much was sent. |
|
virtual |
Sends a buffer to a network byte ordered address.
| Data | The buffer to send. |
| Count | The size of the data to send. |
| BytesSent | Will indicate how much was sent. |
| Destination | The network byte ordered address to send to. |
|
pure virtual |
Sets a socket into broadcast mode (UDP only).
| bAllowBroadcast | Whether to enable broadcast or not. |
|
pure virtual |
Sets whether and how long a socket will linger after closing.
| bShouldLinger | Whether to have the socket remain open for a time period after closing or not. |
| Timeout | The amount of time to linger before closing. |
|
pure virtual |
Sets the interface used to send outgoing multicast datagrams.
Multicast traffic is sent using the default interface, this allows to explicitly set the interface used to send outgoing multicast datagrams.
| InterfaceAddress | The interface address. |
|
pure virtual |
Enables or disables multicast loopback on the socket (UDP only).
This setting determines whether multicast datagrams are looped back to the sending socket. By default, multicast loopback is enabled. It must be enabled if more than one listener is present on a host.
| bLoopback | Whether loopback should be enabled. |
|
pure virtual |
Sets the time to live (TTL) for multicast datagrams.
The default TTL for multicast datagrams is 1, which prevents them from being forwarded beyond the local subnet. Higher values will allow multicast datagrams to be sent into neighboring subnets, if multicast capable routers are present.
| TimeToLive | Number of hops the datagram can make. |
|
pure virtual |
Sets this socket into TCP_NODELAY mode (TCP only).
| bIsNoDelay | Whether to enable no delay mode. |
|
pure virtual |
Sets this socket into non-blocking mode.
| bIsNonBlocking | Whether to enable blocking or not. |
|
pure virtual |
Sets the size of the receive buffer to use.
| Size | The size to change it to. |
| NewSize | Will contain the size that was set (in case OS can't set that). |
|
pure virtual |
Enables error queue support for the socket.
| bUseErrorQueue | Whether to enable error queuing or not. |
|
virtual |
Sets whether to retrieve the system-level receive timestamp, for sockets
| bRetrieveTimestamp | Whether to retrieve the timestamp upon receive |
|
pure virtual |
Sets whether a socket can be bound to an address in use.
| bAllowReuse | Whether to allow reuse or not. |
|
pure virtual |
Sets the size of the send buffer to use.
| Size | The size to change it to. |
| NewSize | Will contain the size that was set (in case OS can't set that). |
|
pure virtual |
Shuts down the socket, making it unusable for reads and/or writes.
This does not close the socket!
| Types |
|
pure virtual |
Blocks until the specified condition is met.
| Condition | The condition to wait for. |
| WaitTime | The maximum time to wait. |
|
pure virtual |
Waits for a pending connection on the socket.
| out | bHasPendingConnection Will indicate whether a connection is pending or not. |
| WaitTime | The maximum time to wait for a connection. If zero, the function will not wait and will return immediately with a value in bHasPendingConnection. |