Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RemoteServer.cs
Go to the documentation of this file.
1using System;
2using System.IO;
5
6namespace Terraria;
7
8public class RemoteServer
9{
10 public ISocket Socket = new TcpSocket();
11
12 public bool IsActive;
13
14 public int State;
15
16 public int TimeOutTimer;
17
18 public bool IsReading;
19
20 public byte[] ReadBuffer;
21
22 public string StatusText;
23
24 public int StatusCount;
25
26 public int StatusMax;
27
29
31
33
35
36 public void ResetSpecialFlags()
37 {
38 ServerSpecialFlags = (byte)0;
39 }
40
41 public void ClientWriteCallBack(object state)
42 {
43 NetMessage.buffer[256].spamCount--;
44 }
45
46 public void ClientReadCallBack(object state, int length)
47 {
48 try
49 {
51 {
52 if (length == 0)
53 {
54 Netplay.Disconnect = true;
55 Main.statusText = Language.GetTextValue("Net.LostConnection");
56 }
57 else if (Main.ignoreErrors)
58 {
59 try
60 {
62 }
63 catch
64 {
65 }
66 }
67 else
68 {
70 }
71 }
72 IsReading = false;
73 }
74 catch (Exception value)
75 {
76 try
77 {
78 using StreamWriter streamWriter = new StreamWriter("client-crashlog.txt", append: true);
79 streamWriter.WriteLine(DateTime.Now);
80 streamWriter.WriteLine(value);
81 streamWriter.WriteLine("");
82 }
83 catch
84 {
85 }
86 Netplay.Disconnect = true;
87 }
88 }
89}
override void WriteLine(string? value)
static string GetTextValue(string key)
Definition Language.cs:15
static bool ignoreErrors
Definition Main.cs:742
static void ReceiveBytes(byte[] bytes, int streamLength, int i=256)
static MessageBuffer[] buffer
Definition NetMessage.cs:61
static bool Disconnect
Definition Netplay.cs:55
void ClientWriteCallBack(object state)
void ClientReadCallBack(object state, int length)
bool ServerWantsToRunCheckBytesInClientLoopThread
static DateTime Now
Definition DateTime.cs:103