Tag: 端口

无法尝试从串行端口接收数据

嗨我有一个端口连接到我的电脑,它不断发送数据,我的目标是从它接收数据并打印出来。 问题是我真的不知道它发送的是什么类型的数据,我该怎么读它… private void Button_Receive_Data_Click(object sender, EventArgs e) { GroupBox_Serial_Transmit.Enabled = false; #region string Port_Name = ComboBox_Available_SerialPorts.SelectedItem.ToString(); int Baud_Rate = Convert.ToInt32(ComboBox_Standard_Baundrates.SelectedItem); COMport = new SerialPort(Port_Name, Baud_Rate); #endregion COMport.ReadTimeout = 3500; //3.5 sekundes try { COMport.Open(); if (COMport.IsOpen == true) { TextBox_System_Log.Text = Port_Name + Environment.NewLine + Baud_Rate; ReceivedData = COMport.ReadExisting(); this.Invoke(new EventHandler(ShowData)); GroupBox_Serial_Transmit.Enabled = true; […]

使用C#列出使用的TCP端口

这是我的问题的答案。 如何在C#中列出绑定/使用的TCP端口。 使用jro修改过的代码 static void ListUsedTCPPort(ref ArrayList usedPort) { IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties(); IPEndPoint[] tcpConnInfoArray = ipGlobalProperties.GetActiveTcpListeners(); IEnumerator myEnum = tcpConnInfoArray.GetEnumerator(); while (myEnum.MoveNext()) { IPEndPoint TCPInfo = (IPEndPoint)myEnum.Current; usedPort.Add(TCPInfo.Port); } } 原始问题。 这就是我使用C#列出TCP端口的方法。 它是我在这个论坛中找到的修改后的代码(忘了我到底的确切位置。如果你是原始开发者,请通知我并将应付信用点放到应有的位置。) //List used tcp port static void ListUsedTCPPort(ref ArrayList usedPort) { IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties(); TcpConnectionInformation[] tcpConnInfoArray = ipGlobalProperties.GetActiveTcpConnections(); IEnumerator myEnum = […]

如何在C#中获取开放端口的进程名称?

如何在C#中获取开放端口的进程名称?

在网络中查找打开的TCP端口

我正在尝试构建一个netowrk应用程序。 我成功地制作了一个发送和接收包的服务器。 到目前为止,测试已在一台指向127.0.0.1的计算机上完成(没有像家一样的地方)。 现在我想切换到网络。 如何在LAN网络上找到正在侦听我的特定端口的计算机?

无法在VS 2010中将控制台应用程序转换为WPF应用程序

我创建了一个控制台应用程序,后来我决定将其作为WPF应用程序更好地运行。 我将输出类型更改为Windows应用程序并添加了我认为必要的引用。 不幸的是,右键单击项目不允许我添加资源字典或许多其他WPF类型。 我错过了什么?

使用自动化Windows防火墙

我有C#应用程序使用PORT 777进行异步通信,PORT 3306用于与My Sql Server进行通信。 端口被防火墙阻止时出现问题。 我试图创建一个程序,在Windows 7的防火墙列表中添加一个例外。 当我运行程序时,我得到如下错误:“灾难性故障(HRESULTexception:0x8000FFFF(E_UNEXPECTED))”。 我不明白这些错误是什么意思,欢迎提出任何建议,谢谢。 protected internal void AddExceptionToFirewall(){ try { INetFwMgr fireWall = null; INetFwAuthorizedApplications apps = null; INetFwAuthorizedApplication app = null; Type progID = null; INetFwOpenPorts ports = null; INetFwOpenPort asyncPort = null; INetFwOpenPort mysqlPort = null; bool appFounded = false; bool asyncPortFounded = false; bool mysqlPortFounded = […]

当我尝试侦听端口时,请求的地址在其上下文中无效

我正在尝试使用网络连接到传感器,传感器的ip在端口3000上是192.168.2.44 ; 我的代码: byte[] byteReadStream = null; // holds the data in byte buffer IPEndPoint ipe = new IPEndPoint(IPAddress.Parse(“192.168.2.44”), 3000);//listen on all local addresses and 8888 port TcpListener tcpl = new TcpListener(ipe); while (true) { //infinite loop tcpl.Start(); // block application until data and connection TcpClient tcpc = tcpl.AcceptTcpClient(); byteReadStream = new byte[tcpc.Available]; //allocate space […]

在c#中查找gsm调制解调器端口

我想遍历可用的端口:System.IO.Ports.SerialPort.GetPortNames()以查找gsm调制解调器是否使用了一个端口。 请问任何想法。