tModLoader v2024.03
A mod to make and play Terraria mods
NetSocialModule Class Referenceabstract

Inherits ISocialModule, Terraria.Social.Base.NetSocialModule, and Terraria.Social.Base.NetSocialModule.

Inherited by NetClientSocialModule, NetClientSocialModule, NetServerSocialModule, and NetServerSocialModule.

Public Types

enum  ConnectionState {
  Inactive , Authenticating , Connected , Inactive ,
  Authenticating , Connected
}
 
enum  ConnectionState {
  Inactive , Authenticating , Connected , Inactive ,
  Authenticating , Connected
}
 

Public Member Functions

abstract void CancelJoin ()
 
abstract bool CanInvite ()
 
abstract void Close (RemoteAddress address)
 
abstract void Connect (RemoteAddress address)
 
abstract ulong GetLobbyId ()
 
abstract void Initialize ()
 
override void Initialize ()
 
override void Initialize ()
 
abstract bool IsConnected (RemoteAddress address)
 
override bool IsConnected (RemoteAddress address)
 
override bool IsConnected (RemoteAddress address)
 
abstract bool IsDataAvailable (RemoteAddress address)
 
override bool IsDataAvailable (RemoteAddress address)
 
override bool IsDataAvailable (RemoteAddress address)
 
abstract void LaunchLocalServer (Process process, ServerMode mode)
 
abstract void OpenInviteInterface ()
 
abstract int Receive (RemoteAddress address, byte[] data, int offset, int length)
 
override int Receive (RemoteAddress address, byte[] data, int offset, int length)
 
override int Receive (RemoteAddress address, byte[] data, int offset, int length)
 
abstract bool Send (RemoteAddress address, byte[] data, int length)
 
override bool Send (RemoteAddress address, byte[] data, int length)
 
override bool Send (RemoteAddress address, byte[] data, int length)
 
abstract void Shutdown ()
 
override void Shutdown ()
 
override void Shutdown ()
 
abstract bool StartListening (SocketConnectionAccepted callback)
 
abstract void StopListening ()
 
void Initialize ()
 
void Shutdown ()
 

Protected Member Functions

 NetSocialModule (int readChannel, int writeChannel)
 
delegate void AsyncHandshake (CSteamID client)
 
RailID GetLocalPeer ()
 
P2PSessionState_t GetSessionState (CSteamID userId)
 
bool GetSessionState (RailID userId, RailNetworkSessionState state)
 
virtual void OnLobbyChatMessage (LobbyChatMsg_t result)
 
RailID RemoteAddressToRailId (RemoteAddress address)
 
CSteamID RemoteAddressToSteamId (RemoteAddress address)
 

Protected Attributes

ConcurrentDictionary< CSteamID, ConnectionState > _connectionStateMap = new ConcurrentDictionary<CSteamID, ConnectionState>()
 
ConcurrentDictionary< RailID, ConnectionState > _connectionStateMap = new ConcurrentDictionary<RailID, ConnectionState>()
 
Lobby _lobby = new Lobby()
 
SteamP2PReader _reader
 
WeGameP2PReader _reader
 
object _steamLock = new object()
 
SteamP2PWriter _writer
 
WeGameP2PWriter _writer
 

Static Protected Attributes

static readonly byte[] _handshake
 
const int ClientReadChannel = 2
 
const ushort GamePort = 27005
 
const int LobbyMessageJoin = 1
 
const ushort QueryPort = 27007
 
const int ServerReadChannel = 1
 
const ushort SteamPort = 27006
 

Member Function Documentation

◆ Initialize() [1/3]

abstract void NetSocialModule.Initialize ( )
pure virtual

Implements ISocialModule.

◆ Initialize() [2/3]

override void NetSocialModule.Initialize ( )

Implements ISocialModule.

◆ Initialize() [3/3]

override void NetSocialModule.Initialize ( )

Implements ISocialModule.

◆ Shutdown() [1/3]

abstract void NetSocialModule.Shutdown ( )
pure virtual

Implements ISocialModule.

◆ Shutdown() [2/3]

override void NetSocialModule.Shutdown ( )

Implements ISocialModule.

◆ Shutdown() [3/3]

override void NetSocialModule.Shutdown ( )

Implements ISocialModule.

Member Data Documentation

◆ _handshake

readonly byte [] NetSocialModule._handshake
staticprotected
Initial value:
= new byte[10] {
10,
0,
93,
114,
101,
108,
111,
103,
105,
99
}