public static bool IsBanned(RemoteAddress address) { try { string identifier = address.GetIdentifier(); if (File.Exists(Netplay.BanFilePath)) { using (StreamReader streamReader = new StreamReader(Netplay.BanFilePath)) { string a; while ((a = streamReader.ReadLine()) != null) { if (a == identifier) { return true; } } } } } catch (Exception ex) { #if DEBUG Console.WriteLine(ex); System.Diagnostics.Debugger.Break(); #endif } return false; }
public TcpSocket(TcpClient tcpClient) { this._connection = tcpClient; this._connection.NoDelay = true; IPEndPoint ipEndPoint = (IPEndPoint)tcpClient.Client.RemoteEndPoint; this._remoteAddress = (RemoteAddress)new TcpAddress(ipEndPoint.Address, ipEndPoint.Port); }
void Terraria.Net.Sockets.ISocket.Close() { if (this._remoteAddress == null) { return; } SocialAPI.Network.Close(this._remoteAddress); this._remoteAddress = null; }
void Terraria.Net.Sockets.ISocket.Close() { lock (_connection) { this._connectionDisposed = true; this._remoteAddress = null; this._connection.Close(); } }
void Terraria.Net.Sockets.ISocket.Connect(RemoteAddress address) { TcpAddress tcpAddress = (TcpAddress)address; this._connection.Connect(tcpAddress.Address, tcpAddress.Port); this._remoteAddress = address; lock (_connection) { this._connectionDisposed = false; } }
public PoolSocket(Socket socket) { this._socket = socket; this._socket.NoDelay = true; var endpoint = (IPEndPoint)this._socket.RemoteEndPoint; this._remoteAddress = new TcpAddress(endpoint.Address, endpoint.Port); _connected = true; StartReceiving(); }
public override bool IsConnected(RemoteAddress address) { if (address == null) { return false; } CSteamID steamId = this.RemoteAddressToSteamId(address); if (!this._connectionStateMap.ContainsKey(steamId) || this._connectionStateMap[steamId] != Terraria.Social.Steam.NetSocialModule.ConnectionState.Connected) { return false; } if (this.GetSessionState(steamId).m_bConnectionActive == 1) { return true; } this.Close(address); return false; }
public override bool IsConnected(RemoteAddress address) { if (address == null) { return false; } CSteamID cSteamID = this.RemoteAddressToSteamId(address); if (!this._connectionStateMap.ContainsKey(cSteamID) || this._connectionStateMap[cSteamID] != NetSocialModule.ConnectionState.Connected) { return false; } if (this.GetSessionState(cSteamID).m_bConnectionActive != 1) { this.Close(address); return false; } return true; }
public override int Receive(RemoteAddress address, byte[] data, int offset, int length) { if (address == null) { return 0; } CSteamID steamId = this.RemoteAddressToSteamId(address); return this._reader.Receive(steamId, data, offset, length); }
void ISocket.Connect(RemoteAddress address) { _remoteAddress = address as TcpAddress; var sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); sock.Connect(_remoteAddress.Address, _remoteAddress.Port); SetSocket(sock); }
private static void ClientLoopSetup(RemoteAddress address) { Netplay.ResetNetDiag(); Main.ServerSideCharacter = false; if (Main.rand == null) { Main.rand = new Random((int)DateTime.Now.Ticks); } if (WorldGen.genRand == null) { WorldGen.genRand = new Random((int)DateTime.Now.Ticks); } Main.player[Main.myPlayer].hostile = false; Main.clientPlayer = (Player)Main.player[Main.myPlayer].clientClone(); for (int i = 0; i < 255; i++) { if (i != Main.myPlayer) { Main.player[i] = new Player(); } } Main.netMode = 1; Main.menuMode = 14; if (!Main.autoPass) { Main.statusText = "Connecting to " + address.GetFriendlyName(); } Netplay.disconnect = false; Netplay.Connection = new RemoteServer(); Netplay.Connection.ReadBuffer = new byte[1024]; }
public abstract int Receive(RemoteAddress address, byte[] data, int offset, int length);
public abstract bool IsDataAvailable(RemoteAddress address);
void Terraria.Net.Sockets.ISocket.Connect(RemoteAddress address) { this._remoteAddress = address; SocialAPI.Network.Connect(address); }
protected CSteamID RemoteAddressToSteamId(RemoteAddress address) { return ((SteamAddress)address).SteamId; }
public override void Connect(RemoteAddress address) { }
public abstract bool IsConnected(RemoteAddress address);
public static bool IsBanned(RemoteAddress address) { try { string identifier = address.GetIdentifier(); if (System.IO.File.Exists(Netplay.BanFilePath)) { using (StreamReader streamReader = new StreamReader(Netplay.BanFilePath)) { string str; while ((str = streamReader.ReadLine()) != null) { if (str == identifier) return true; } } } } catch { return false; } return false; }
void ISocket.Close() { this._remoteAddress = (RemoteAddress)null; this._connection.Close(); }
void ISocket.Close() { this._remoteAddress = null; if (this._connection != null) { this._connection.Close(); } }
// // Constructors // public TemporarySynchSock(TcpClient tcpClient) { this._connection = tcpClient; this._connection.NoDelay = true; IPEndPoint iPEndPoint = (IPEndPoint)tcpClient.Client.RemoteEndPoint; this._remoteAddress = new TcpAddress(iPEndPoint.Address, iPEndPoint.Port); }
public override bool Send(RemoteAddress address, byte[] data, int length) { CSteamID steamId = this.RemoteAddressToSteamId(address); this._writer.QueueSend(steamId, data, length); return true; }
public SocialSocket(RemoteAddress remoteAddress) { this._remoteAddress = remoteAddress; }
public abstract void Connect(RemoteAddress address);
public static bool IsBanned(RemoteAddress address) { try { string identifier = address.GetIdentifier(); if (File.Exists(Netplay.BanFilePath)) { using (StreamReader streamReader = new StreamReader(Netplay.BanFilePath)) { string a; while ((a = streamReader.ReadLine()) != null) { if (a == identifier) { return true; } } } } } catch (Exception) { } return false; }
public abstract bool Send(RemoteAddress address, byte[] data, int length);
public void Connect(RemoteAddress address) { }
public override bool IsDataAvailable(RemoteAddress address) { CSteamID steamId = this.RemoteAddressToSteamId(address); return this._reader.IsDataAvailable(steamId); }
void ISocket.Connect(RemoteAddress address) { TcpAddress tcpAddress = (TcpAddress)address; this._connection.Connect(tcpAddress.Address, tcpAddress.Port); this._remoteAddress = address; }
public abstract void Close(RemoteAddress address);