Initial Commit

This commit is contained in:
Shank 2011-05-28 20:49:41 -06:00
commit 5dc0cf584c
3351 changed files with 51753 additions and 0 deletions

56
Terraria/ClientSock.cs Normal file
View file

@ -0,0 +1,56 @@
namespace Terraria
{
using System;
using System.Net.Sockets;
public class ClientSock
{
public bool active;
public bool locked;
public NetworkStream networkStream;
public byte[] readBuffer;
public int state;
public int statusCount;
public int statusMax;
public string statusText;
public TcpClient tcpClient = new TcpClient();
public int timeOut;
public byte[] writeBuffer;
public void ClientReadCallBack(IAsyncResult ar)
{
int streamLength = 0;
if (!Netplay.disconnect)
{
streamLength = this.networkStream.EndRead(ar);
if (streamLength == 0)
{
Netplay.disconnect = true;
Main.statusText = "Lost connection";
}
else if (Main.ignoreErrors)
{
try
{
NetMessage.RecieveBytes(this.readBuffer, streamLength, 9);
}
catch
{
}
}
else
{
NetMessage.RecieveBytes(this.readBuffer, streamLength, 9);
}
}
this.locked = false;
}
public void ClientWriteCallBack(IAsyncResult ar)
{
messageBuffer buffer1 = NetMessage.buffer[9];
buffer1.spamCount--;
}
}
}