public WorldBot() { TCPClientSettings settings = new TCPClientSettings ( ushort.MaxValue, "127.0.0.1", 15051, true ); _tcpClient = new TCPClient(settings); _tcpClient.Connected += TCPConnected; _tcpClient.DataReceived += TCPClientDataReceived; _tcpClient.Disconnected += TCPClientDisconnected; }
public TCPClient(TCPClientSettings settings) { _settings = settings; BufferManager bufferManager = new BufferManager(_settings.BufferSize, 2); _connectEvent = new SocketAsyncEventArgs(); _connectEvent.Completed += IOCompleted; _connectEvent.RemoteEndPoint = _settings.EndPoint; _receiveEvent = new SocketAsyncEventArgs(); _receiveEvent.Completed += IOCompleted; bufferManager.SetBuffer(_receiveEvent); _sendEvent = new SocketAsyncEventArgs(); _sendEvent.Completed += IOCompleted; bufferManager.SetBuffer(_sendEvent); }
private void InitializeEnvironment() { _map = new ClientMap(); _syncScroll = new object(); _fpsCounterData = new byte[10]; _fpsFontBrush = new SolidBrush(Color.White); _playersData = new Dictionary<int, PlayerDataEx>(); _threadWorld = new Thread(WorldProcessingProc); _threadWorld.IsBackground = true; _threadWorld.Start(); _threadObjectChanged = new Thread(ObjectChangedProc); _threadObjectChanged.IsBackground = true; _threadObjectChanged.Start(); TCPClientSettings settings = new TCPClientSettings ( ushort.MaxValue, "127.0.0.1", 15051, true ); _tcpClient = new TCPClient(settings); _tcpClient.Connected += TCPConnected; _tcpClient.DataReceived += TCPDataReceived; _tcpClient.Disconnected += TCPDisconnected; }