Esempio n. 1
0
//		AutoResetEvent m_asyncDataAvailable;

//		ReceiveMessageBuffer m_readBuffer;
//		SendMessageBuffer m_writeBuffer;


		public SocketConnection(SocketTransport transport, SocketHostInfo info)
		{
			m_transport = transport;
			m_info = info;

			m_asyncConnect = new AutoResetEvent(false);

			m_asyncReadBuffer = new byte[512 * 1024];
//			m_asyncDataAvailable = new AutoResetEvent(false);

//			m_readBuffer = new ReceiveMessageBuffer(512 * 1024);
//			m_writeBuffer = new SendMessageBuffer(4 * 1024);
		}
Esempio n. 2
0
		protected SocketHostInfo AddNewConnection()
		{
			SocketHostInfo tcpHostInfo = null;

			AddNewConnectionDialog dialog = new AddNewConnectionDialog();
			if (dialog.ShowDialog() == DialogResult.OK)
			{
				tcpHostInfo = new SocketHostInfo(this, dialog.Host, dialog.Port);

				mBookmarkedHosts.Add(tcpHostInfo);

				string[] hostList = mBookmarkedHosts.ConvertAll<string>(delegate(SocketHostInfo value) { return value.ToString(); }).ToArray();
				string hostString = String.Join(",", hostList);
				if (mDebugger.Manager.Project != null)
				{
					mDebugger.Manager.Project.SetUserConfiguration("TCPHosts", hostString);
				}

			}

			return tcpHostInfo;
		}
Esempio n. 3
0
		static void OnTargetListenerConnected(IAsyncResult ar)
		{
			object[] args = (object[])ar.AsyncState;
			SocketTransport transport = (SocketTransport)args[0];
			Socket listener = (Socket)args[1];
			lock (transport.mLock)
			{
				if (listener == transport.mTargetListener)
				{
					Socket client = listener.EndAccept(ar);
					IPEndPoint endpoint = (IPEndPoint)client.RemoteEndPoint;
					HostInfo hostInfo = new SocketHostInfo(transport, endpoint.Address.ToString(), 51337);
					client.Close();

					try
					{
						transport.DebugManager.MainWindow.Invoke(new CallbackDelegate(Callback), new object[] { transport, hostInfo });
						listener.BeginAccept(new AsyncCallback(OnTargetListenerConnected), new object[] { transport, listener } );
					}
					catch(InvalidOperationException)
					{
						// It's possible the main window hasn't finished creating here
					}
				}
			}
		}